Forums
This topic is locked
strange unexpected else in my short code.
Posted 20 Apr 2007 11:04:28
1
has voted
20 Apr 2007 11:04:28 corey smith posted:
Hiok, after about an hour i've came up with this. It doesn't come up with any errors, and as you can see I have declared strings that have the names of the files that are forbidden to delete, and used the || sign rather than or. Now, for some reason no matter what I type in, it always comes up with the first thing, saying 'sorry that file cannot be deleted'. If I enter in a filename other than delete.php or deleteform.php it still says it can't be deleted. I can't figure out whats wrong! please help me!!
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote><?php
$one="deleteform.html";
$two="delete.php";
if($file == $one || $two)
echo "Sorry, that file cannot be deleted.";
elseif(!filter_has_var(INPUT_GET, "file")
echo "the file name you typed in does not exist. Please try again by clicking the back button on your browser";
else
echo("$file Found. Deleting....."
unlink($file);
?><hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
if you wish to test it out so you can see what it's doing, please go here.
FOR UPLOADING YOUR FILE (PLEASE ONLY UPLOAD VERY SMALL IMAGES IF YOU WISH TO TEST.)
corey19981.freehostia.com/uploadform/form.html
FOR VIEWING FILES
corey19981.freehostia.com/uploadform/uploads/
FOR DELETING FILES -THIS IS THE PART I'M HAVING PROBLEMS WITH
corey19981.freehostia.com/uploadform/uploads/deleteform.html
thanks guys. I really hope you can help me!
Edited by - corey19981 on 20 Apr 2007 12:44:21
Edited by - corey19981 on 20 Apr 2007 16:04:07