note 13352 rejected from function.readdir by sander

From: Date: Sat, 06 Apr 2002 19:15:25 +0000
Subject: note 13352 rejected from function.readdir by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-28752@lists.php.net to get a copy of this message
$fileDir = "/servers/alphanara/pdsallfiles/xnara/pds/"; $fileDir2 = $dest = ""; $findok = $finddisk = $findpds = $findcoded = 0; $handle=opendir($fileDir); while ($file = readdir($handle)) { if ( ereg( "^\." , $file ) ) continue ; $fileDir2 = $fileDir . $file ; echo $file; $handle2 = opendir($fileDir2); while ($file2 = readdir($handle2)) { if ( ereg( $bbstmp[code], $file2)) { $findok = 1; $dest = $fileDir2 ."/" . $bbstmp[code] ; break; } } if ($findok == 1) break; } closedir($handle2); closedir($handle); if ($findok == 1) { $dest = $dest . "/" . $bbstmp[addfile]; if ( (ereg(".jpg", $bbstmp[filename])) || (ereg(".gif", $bbstmp[filename]))) { $fileendtype = 'gif'; if (ereg(".jpg", $bbstmp[filename])) $fileendtype = 'jpeg'; Header ("Content-type: image/$fileendtype"); readfile ( $dest); } else { Header ("Content-Type: application/octet-stream"); header( "Content-Disposition: attachment; filename=$bbstmp[filename]"); readfile ( $dest); } } else echo "file is not found";

« previous php.notes (#28752) next »