Avoid direct access to a file in php enhanced version
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
Related posts:
- How to avoid direct access to a file in php
- Disabling right click menu using javascript Enhanced Version
- Append data to a text file using php
- How To Avoid 404 Error Pages Easily and Reliably
- Simple file upload script using php

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