Ver Mensaje Individual
  #12 (permalink)  
Antiguo 13/10/2008, 10:56
Avatar de uselox
uselox
 
Fecha de Ingreso: agosto-2008
Ubicación: Lima, Perú
Mensajes: 168
Antigüedad: 15 años, 8 meses
Puntos: 12
Respuesta: Ayuda, mostrar archivos aleatoriamente

Mas q esto No creo q aya -.-
Código PHP:
<?php
/*
   ********************************
   *             Created By RuzZ                     *
   *                Open Source                        *
   ********************************
                                  */
$dir='favorites/'
if (
$handle opendir($dir)) {
    while (
false !== ($file readdir($handle))) {
        if (!
is_dir($dir.$file) && $file != "." && $file != "..") {
            
$archivos[]=substr(urlencode($file), 0strlen(urlencode($file))-4);
        }
    }
    
closedir($handle);
}
/*|RuzZ And Paty|*/
$cantidad=count($archivos)-1;
for(
$i=0;$i<=$cantidad;$i++)$lenght+=strlen($archivos[$i].",");
$random="";
while(
$lenght!=strlen($random))
{
  for(
$i=0;$i<=$cantidad;$i++)
  {
    
$rand=mt_rand(0,$cantidad);
    
$posision=substr_count($random,$rand.",");
    if(
$posision==false)
    {
      
$random.=$archivos[$rand].",";
    }
  }
}
$cadena=substr($random,0,-1);
$aleatorio=explode(",",$cadena);//new array random elemments
//---
print_r($aleatorio);
?>