Avoid direct access to a file in php enhanced version

This Tutorial Has Been Viewed 1,263 Times.

Some months before i have written a code to avoid the direct access of files using php, but now i have modified the previous script since it has some set backs, Let us take one file named MYFILE.PHP as an example, all you have to do is just add the below code on the top of  all the script.

< ?php
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'MYFILE.PHP' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
?>

Always remember to change the file name accordingly.I have given that area in BOLD and CAPS

VN:F [1.9.13_1145]
Rating: 2.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: -1 (from 1 vote)

Avoid direct access to a file in php enhanced version, 2.0 out of 10 based on 1 rating

Incoming search terms:





You will also be interested in ,

Tags: ,

One Response

  1. I’m happy! It is simple to see that you are passionate about your writing. Looking forward to future posts. Thanks!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP, scripts (81 of 149 articles)