Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Don't use relative path to your include, but an absolute, and you'll be ok
PHP Code:
require_once($_SERVER['DOCUMENT_ROOT']."/cat.php");
This will ensure that you always require() the file in the root folder of your site.
And if you want to include another file if it exists or fall back on the one in the root folder:
PHP Code:
$file=$_SERVER['DOCUMENT_ROOT']."/cat.php"; if(is_file($_SERVER['DOCUMENT_ROOT']."/back-up/cat.php")===true){ //if the file back-up/cat.php exists only $file=$_SERVER['DOCUMENT_ROOT']."/back-up/cat.php"; } require_once($file);
__________________
Only a biker knows why a dog sticks his head out the window.
|