"; echo ""; while (false !== ($file = readdir($handle))) { if (($file !== ".") and ($file !== "..") and (!ereg("$linked_file",$file))) { if (ereg("\.",$file)) { $filestore[$maxloop]=$file; $file_or_dir[$maxloop]="File"; $maxloop++; } else { $filestore[$maxloop]=$file; $file_or_dir[$maxloop]="Dir"; $maxloop++; } } } array_multisort ($file_or_dir, SORT_ASC, $filestore, SORT_ASC, SORT_STRING); $start_col = 0; $loop = 0; while ($loop!=$maxloop) { $file=$filestore[$loop++]; if (($file !== ".") and ($file !== "..") and (!ereg("$linked_file",$file))) { $directory = ""; $link = ""; $filesize = ""; $time_str = ""; $date_str = ""; if ($file != "thumbnail") { if (ereg("\.",$file)) { $filesize = round(filesize("$direct_path$file")/1024,2); $date_str = getdate(fileatime("$direct_path$file")); $year = $date_str["year"]; $mon = $date_str["mon"]; $mday = $date_str["mday"]; $hours = $date_str["hours"]; $minutes = $date_str["minutes"]; $seconds = $date_str["seconds"]; if ($hours < 10) { $hours = 0 . $hours; } if ($minutes < 10) { $minutes = 0 . $minutes; } if ($seconds < 10) { $seconds = 0 . $seconds; } $directory = 0; $virtual_path = ereg_replace("//","/",$virtual_path); $link = "$virtual_path$file"; $date_str = "$mday/$mon/$year"; $time_str = "$hours:$minutes:$seconds"; } else { $virtual_path = ereg_replace("//","/",$virtual_path); $directory = 1; $link = "$linked_file?next_path=$virtual_path$file/"; } $link = ereg_replace(" ","%20","$link"); $filename = $file; $thumb_direct_path = ereg_replace(" ","%20","$direct_path"); $thumb_file = ereg_replace(" ","%20","$file"); $create_thumb_folder = ereg_replace("%20"," ","$thumb_direct_path"); $create_thumb_file = ereg_replace("%20"," ","$thumb_file"); if (file_exists($create_thumb_folder . "thumbnail/") != TRUE) { mkdir($create_thumb_folder . "thumbnail/"); } $start_col++; if ($start_col == 1) { echo ""; } echo ""; if ($start_col == 5) { echo ""; $start_col = 0; } } } } echo "
"; if ($directory > 0) { echo "Directory
"; } if (eregi("\.(jp(e)?g)|(png)|(bmp)",$file)) { if ((file_exists($create_thumb_folder . "thumbnail/" . $create_thumb_file)) && (filemtime($create_thumb_folder . "thumbnail/" . $create_thumb_file) > filemtime($create_thumb_folder . $create_thumb_file))) { echo "
"; } else { echo "
"; } } echo "$filename
$image_location
"; if ($filesize) { if ($filesize > "1024") { $filesize_type = round($filesize/1024,2); echo " $filesize_type MB"; } else { echo " $filesize KB
"; } } if ($date_str) { echo " $date_str"; } echo "

"; closedir($handle); } $this_filename = ereg_replace("(.*)/(.*)","\\2",$_SERVER["PHP_SELF"]); $direct_path = ereg_replace("(.*)$this_filename","\\1",$_SERVER["PATH_TRANSLATED"]); $virtual_path = ereg_replace("$this_filename","",$_SERVER["PATH_INFO"]); if ($_REQUEST["next_path"]) { $safe_lookup = ereg_replace("\.\.","",$_REQUEST["next_path"]); $direct_path = $direct_path . "/" . $safe_lookup; $virtual_path = $virtual_path . "/" . $safe_lookup; } scan_dir($direct_path, $virtual_path, $this_filename); ?>