I have many pages my problem stands that I need to open all my php files and add a line of code at the top of each php page.
<?php
if(!defined('no_d_a')){die('What The ... how did you get here :) ');} /* no direct access */
// rest of existing code here //
?>
Question is can I instead do this on a .htaccess file because I am feeling abit lazy :)
TIA
There is a PHP ini setting called:
auto_prepend_file
, where you can set the name of a file wich will be included into every PHP script at the top!You can now set this setting in your .htaccess like this:
Check this good tutorial
I think what your wanting is a way to prepend the files with htaccess? If so here ya go:
Save this as 'prepend.php'
in your .htaccess add:
it will prepend all .php files with 'prepend.php'
You may want to have some conditional clauses.. but that should get you started..
You can also append files with 'auto_append_file' instead of 'auto_prepend_file'