Jump to content

[SOLVED] PHP - Using wildcard on if statement?


Gamerz

Recommended Posts

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";
?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.