How can I add one line into all php files' beginning?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-05-31T14:45:21Z Indexed on 2010/05/31 14:53 UTC
Read the original article Hit count: 149

Filed under:
|

So, ok. I have many php files and one index.php file. All files can't work without index.php file, because I include them in index.php. For example. if somebody click Contact us the URL will become smth like index.php?id=contact and I use $_GET['id'] to include contacts.php file. But, if somebody find the file's path, for example /system/files/contacts.php I don't want that that file would be executed. So, I figured out that I can add before including any files in index.php line like this $check_hacker = 1 and use if in every files beginning like this if($check_hacker <> 1) die();. So, how can I do it without opening all files and adding this line to each of them? Is it possible? Because I actually have many .php files. And maybe there is other way to do disable watching separate file? Any ideas?
Thank you.

© Stack Overflow or respective owner

Related posts about php

Related posts about security