Hello all, I’m Joey. Having a minor problem and not sure of what the best way to solve it is…
First a little background so you can understand what im trying to do:
Im making a website for a friend of mine who is a photographer, she wants her users to be able to go to a galleries page and enter a pass phrase which will let them preview their photos she has taken. Im trying to make it easy for her to give out pass phrases by just having her make a directory, with a name that will be the passphrase, then just dropping the images into the directory. I’ve gotten it completely working except if the user enters a passphrase that doesnt exist. It will give me an error like this:
Warning: opendir(galleries/ad) [function.opendir]: failed to open dir: No such file or directory in /home/content/07/9905207/html/galviewer.php on line 12
What I want it to do is if I get this error, I want it to just say a custom message that I can write up instead…
Idk if looking at what Ive got written already will change anything at all, but here is the small bit of code im using on the landing page…
[php]$dname = $_GET[‘dname’];
if ($handle = opendir(“galleries/$dname”)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != “.” && $entry != “…”) {
echo “$entry\n
”;
}
}
closedir($handle);
}[/php]
Please note, that I am new to php and I do realize im using a get method for a password… just ignore that bit