I have a website with a lot of php files. I need to to have the line (where "requiredfile.php"' should be a valid reference to the requiredfile.php in the top directory):
require "requiredfile.php" as first line in every php file. The requiredfile.php will be in the top dir and the line I mentioned must contain a valid reference to the requiredfile.php. PLease help me with a script for this task. Thanks.
I think you want something like this.
<?php
// Required file
$DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
require_once($DOCUMENT_ROOT.'requiredfile.php');
//rest of code under here
?>
I was looking for unix script involving sed or something like that.