Prevent direct access of script
Started on: 04 January 13
Participants: 1
I have a php script which either included by some other scirpt or it is running as a cron.
Due to some resons I have to keep in a webroot folder.
I need a solution by which no one run the script directly as (e.g. http://mysite.com/tt.php)
Due to some resons I have to keep in a webroot folder.
I need a solution by which no one run the script directly as (e.g. http://mysite.com/tt.php)
This challenge is listed under
Open Source
and Development & Implementations
Community
Related Posts:
Please login to reply this post
Important:
- We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
- To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
- Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
1 Suggestion
Try this
function yourfun(){ if($_SERVER['REQUEST_URI'] == $_SERVER['PHP_SELF']) { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found', true, 404); exit; } }