[SOLVED] Just an easy question. Should be solved quick.
Posted: Wed Jul 28, 2004 7:44 am
Hey guys, im backkk lol.. Ok, i just wanna know something.
ok, say i've got two files /admin/indexA.php and /indexR.php, , which both Include the file /config.php. In the config, i want it to determine which file it is thats being loaded. I want it to be able to tell the directory.
SO I would assume something like:
So the _SERVER["SCRIPT_FILENAME"] brings back the full directory plus filename:
/var/www/php2/admin/phpinfo.php
So it needs to see if it can find admin within the variable, and strip it out to set as the running varible.. easy enough.. I just forget the proper syntex to search a variable for certain text.
ok, say i've got two files /admin/indexA.php and /indexR.php, , which both Include the file /config.php. In the config, i want it to determine which file it is thats being loaded. I want it to be able to tell the directory.
SO I would assume something like:
Code: Select all
<?php
in my config.php have:
$markvar== $_SERVER["SCRIPT_FILENAME"]
If $markvar Preg_Match(?? or something??) ANY = admin
have dirroot= /admin
or
If $markvar CheckForInstanceOfText = _SERVER["SCRIPT_FILENAME"]
then have dirroot="/"
?>/var/www/php2/admin/phpinfo.php
So it needs to see if it can find admin within the variable, and strip it out to set as the running varible.. easy enough.. I just forget the proper syntex to search a variable for certain text.