PHP - include index.php for path above this one [closed]
So, am using this code here...
<?php
if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
include(dirname(dirname(__FILE__)) . '/index.php');
else
exit;
?>
So I have a filepath like so:
/root/folder/a_sub1/b_sub1/c_sub1/d_sub1
Each *_sub folder has a file index.php
with the above code in it. The folder directory has the following code in its index.php file.
<?php
// Look for Settings.php....
if (file_exists(dirname(dirname(__FILE__)) . '/Settings.php'))
{
// Found it!
require(dirname(dirname(__FILE__)) . '/Settings.php');
header('Location: ' . $boardurl);
}
// Can't find it... just forget it.
else
exit;
?>
The root folder has Settings.php within it that defines the $boardurl
to be: http://dptest.dream-portal.net
, so why is it NOT redirecting to the $boardurl
when I type in the url like this?
http://dptest.dream-portal.net/folder/a_sub1
To my understanding, it should include each index.php file within each path above it, until it gets to folder and than it should call upon Settings.php within the root and this should than just load up the $boardurl
(http://dptest.dream-portal.net) in开发者_C百科stead right? Makes sense to me, but instead I am getting a 500 Internal Server Error when browsing any subdirectories within the folder directory...
Can someone please help me here.
Cheers :)
精彩评论