$info = getFolder("./");
if(isset($HTTP_GET_VARS["file"])){
$file = $HTTP_GET_VARS["file"];
echo html_image($file);
}else{
foreach($info[1] as $i=>$value){
if($value != "index.php"){
echo "$value
";
}
}
}
function html_image($image,$par=''){
if(!is_file($image)){return "There's no image";}
if(is_string($image)){
$infor = GetImageSize($image);
if($infor["mime"] == "application/x-shockwave-flash"){
$string = "\n";
}else{
$string = "
";
}
return $string;
}else{echo "Error: It is not string";return "";}
}
function getFolder($_location){
$dh = opendir($_location);
while (false !== ($filename = readdir($dh))) {
if(is_dir($_location.$filename) && $filename!='.' && $filename!='..'){$folder[] = $filename;} //is Folder
if(is_file($_location.$filename)){
$file[] = $filename;
$file_info[] = GetImageSize($_location.$filename);
} // is file
}
closedir($dh);
if(empty($file_info)){
$image = '';
}else{
foreach($file_info as $i=>$value){
if(substr_count($value['mime'],"image/") or substr_count($value['mime'],"x-shockwave-flash")){
$image[] = $file[$i];
}
}}
if(empty($folder)){$folder = "";}
if(empty($file)){$file = "";}
if(empty($image)){$image= "";}
return array($folder,$file,$image);
}
?>