Thanks Jim,
That would only work on your server, but I was looking for something more
universal.
Mine's "/home/circlec/includes/" because I can't afford a dedicated server.
Have come up with this and would be interested to know if it works for you.
I've no idea how universal it will be.
<?php
function server_root($file) {
$root = explode('/', $_SERVER['DOCUMENT_ROOT']);
array_pop($root);
array_push($root, $file);
$file = implode('/', $root);
return $file;
}
include server_root("includes/globals.php");
?>
It pops the root directory and pushes the dir/filename back onto the array, and
implodes back to a string. James gave me the idea.
I tend to put functions in the include that every page calls, so cutting down
the amount of includes per page. The header gets echoed, but the footer is a
function (and other stuff) so I'll insert the function there, as every page
calls a DB at some point.
I notice that you refered to "below my home page", and this may be why my
original question was ambiguous. Is it above or below root? If directories are
as trees, then it is above, but the root of a tree in always at the bottom.
I'm still learning, but some professionals on here seem to forget this group
isn't just for them alone.
Put-downs probably make them feel big.
Bob.
----- Original Message -----
From: "daugsberg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, December 12, 2005 8:48 PM
Subject: [php-list] Re: Read a file below root
>I had "heard" the same recommendation - store sensitive data outside
> of the /www directory structure. So, I created a directory called
> /includes right below my home page, e.g. - /home/xyz/includes. In my
> program I placed the statement:
> include("/home/xyz/includes/globals.php"); and this worked fine. My
> website is running on paid server space.
>
> Jim
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/