I've written a script that searches a given directory and finds all the text files in it. Each of my users has a Profile that is stored in their own text file. I circulate through the directory, take information from each file, and post it. I am getting an error that reads like this: "Warning: Supplied argument is not a valid Directory resource in [directory]cr3w.php on line 19"
I had a code savvy friend look it over and it looks fine... not sure what is up.
<?PHP
$dir = "/Volumes/Portfolio/jamesm/Sites/passwords/profiles";
while ($textfile = readdir($dir)) {
if($textfile != "WS_FTP.LOG"){
if (!is_dir($textfile)) {
$profile = file($textfile);
foreach($profile as $line){
$line = trim($line);
$entries = explode("|!!|", $line);
$name = $entries[0];
$quote = $entries[2];
$beverage = $entries[3];
$info = $entries[4];
$rig = $entries[5];
$imagename = str_replace(".txt",".jpg","$textfile");
echo "<tr><td width=150 valign=top><img src=images/" . $imagename . " width=150></td>";
echo "<td><b><font color=red>" . $name . "</font></b><br>";
if ($name == "Trid3nt")
echo "Position: Organizer, Network/Tech Support, Webmaster, and Vid Guy<br>";
if ($name == "J45p3r")
echo "Position: Network Admin, Tech Support, Co-Organizer<br>";
if ($name == "Doram")
echo "Position: Security<br>";
echo "Quote: \"" . $quote . "\"<br>";
echo "Favorite LAN Beverage: " . $beverage . "<br>";
echo "Info:<br><blockquote><i>\"" . $info . "\"</i></blockquote><br>";
echo "Rig: " . $rig . "<br></blockquote><br></td></tr>";
}
}
}
}
?>