Gamerz Posted July 14, 2009 Share Posted July 14, 2009 Hi, in the below code, find: OR $id == "*.php" I'm trying to use a wildcard for this, so anyone deleting a php file will lead to die("Error: The file you are deleting has been restricted for delete."); But I'm wondering what's the correct way to place a wildcard on $id == "*.php" instead of plain asteriok cuz I tried it, and it doesn't work... Here's the code: <?php $id = $_GET['filename']; if($id == "delete.php" OR $id == "delete_file.php" OR $id == "download.php" OR $id == "*.php") die("Error: The file you are deleting has been restricted for delete."); unlink($filename) or die('The filename you entered has never been uploaded to our servers. <a href="delete_file.php">Please click here to try again</a>.'); echo "You have successfully deleted $filename"; ? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted July 14, 2009 Share Posted July 14, 2009 well...what is the common part? the last four characters. so, let's just look at the those: if(substr($id,-4) == ".php") Quote Link to comment Share on other sites More sharing options...
Gamerz Posted July 14, 2009 Author Share Posted July 14, 2009 Ohh, I got it...ok, thank you so much. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.