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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.