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"; ? Link to comment https://forums.phpfreaks.com/topic/165871-solved-php-using-wildcard-on-if-statement/ 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") Link to comment https://forums.phpfreaks.com/topic/165871-solved-php-using-wildcard-on-if-statement/#findComment-874916 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. Link to comment https://forums.phpfreaks.com/topic/165871-solved-php-using-wildcard-on-if-statement/#findComment-874917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.