I am creating a database connection path that check for a session variable
to get the username, password, dbname, etc., but if the session has not been
set yet, I need my script to get those values from another file
(KEY.txt) where they are saved. I want to access this class from two
directories, and this text file (KEY.txt) is in a directory above both. Like
this:

root: folder1 - folder2

folder1: KEY.txt

folder2: index.php - database.php - folder3

folder3: index.php

I need to use database.php in both index files, but database.php references
KEY.txt. So my question is, do I have to check which directory the calling
script is in (ie. which index.php file is using database.php) and add the
according up directory references, or do I need to use some kind of
$_SERVER[DOCUMENT_ROOT]
thing?

Any help would be appreciated!

Reply via email to