$content_array = array(); $dir = "Upload"; $text = "$dir/Thumbs/pinfo.db"; $fhr = fopen($text, 'r') or die("can't open file $text"); $fha = fopen($text, 'a') or die("can't open file $text"); rewind($fhr); $pname = fgets($fhr); substr_replace($pname,"",-1); $punit = fgets($fhr); $pinfo = fgets($fhr); $app = fgets($fhr); rewind($fhr); $opendir = opendir($dir); $i=0; while (($file = readdir($opendir)) !==FALSE) { if ($file!="."&&$file!=".."&&$file!="Thumbs") { if(file_exists("$dir/Thumbs/$file") == FALSE) { $srcImg = imagecreatefromstring(file_get_contents("$dir/$file")); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $thumbImg = imagecreatetruecolor(100, 100); imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, 100, 100, $origWidth, $origHeight); imagejpeg($thumbImg,"$dir/Thumbs/$file"); } $content_array[$i][0] = $file; $content_array[$i][1] = date ("Y m d", filemtime($dir."/".$file)); rewind($fhr); while(!feof($fhr) && $content_array[$i][0] !== "$pname.JPEG" && $content_array[$i][0] !== "$pname.JPG" && $content_array[$i][0] !== "$pname.jpg" && $content_array[$i][0] !== "$pname.jpeg") { $pname = fgets($fhr); $pname = trim($pname); if($content_array[$i][0] == $pname . ".JPEG" || $content_array[$i][0] == $pname . ".JPG" || $content_array[$i][0] == $pname . ".jpg" || $content_array[$i][0] == $pname . ".jpeg"){break;} if(feof($fhr) && $file !== $pname . ".JPEG" && $file !== $pname . ".JPG" && $file !== $pname . ".jpg" && $file !== $pname . ".jpeg"){$pname = "";} } $content_array[$i][2] = $pname; if($content_array[$i][0] == "$pname.JPEG" || $content_array[$i][0] == "$pname.JPG" || $content_array[$i][0] == "$pname.jpg" || $content_array[$i][0] == "$pname.jpeg"){ $punit = stripslashes(fgets($fhr)); $pinfo = stripslashes(fgets($fhr)); $app = fgets($fhr); rewind($fhr); } else { $pname = substr($file, 0, strrpos($file, '.')); $punit = ""; $pinfo = "null"; $app = 1; fwrite($fha, "\n$pname\n"); fwrite($fha, "$punit\n"); fwrite($fha, "$pinfo\n"); fwrite($fha, "$app"); rewind($fhr); } $content_array[$i][3] = $punit; $content_array[$i][4] = trim($pinfo); $content_array[$i][5] = $app; rewind($fhr); $i++; } } closedir(); $q = 0; foreach($content_array as $res) $sortAux[] = $res[1]; array_multisort($sortAux, SORT_DESC, $content_array); foreach($content_array as $imager){ if ($imager[5] == 1){ $q++; if($imager[4] !== "null"){ $plopper = "info:#information$q"; $infoz = $imager[4];} else { $plopper = "";} echo "
$imager[4]
"; }} ; fclose($fhr); fclose($fha);