skip to Main Content

I want to prevent the running of x.php but I can’t see how to do it in cPanel. I also can’t see how to do it the .htaccess. How can I do this?

2

Answers


  1. My suggestion would be to modify the file with a run key that only you know.

    <?php
    if (!isset($_GET['runkey']) || ($_GET['runkey'] != my-secret-value)) {
       die("You do not have permission to run this script");
    }
    

    Then when you wanted to run the script, you’d call it with

    https://my-site.com/my_script.php?runkey=my-secret-value

    Login or Signup to reply.
  2. Change the file’s permissions so it is not executable. You can do this from either cPanel, FTP (right-click the file and change permissions) or from the command line (chmod).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search