rendered paste body<?PHPfunction choose_pic() { $dirlist = scandir("change/"); $rand = mt_rand(0,count($dirlist)); $pic = $dirlist[$rand]; if (!ereg(".jpg$", $pic)) { $pic = choose_pic(); } return $pic;} // // Scandir for PHP4 // if(!function_exists('scandir')) { function scandir($dir, $sortorder = 0) { if(is_dir($dir)) { $dirlist = opendir($dir); while( ($file = readdir($dirlist)) !== false) { if(!is_dir($file)) { $files[] = $file; } } ($sortorder == 0) ? asort($files) : arsort($files); return $files; } else { return FALSE; break; } } }?>