Page 1 of 1

[SOLVED] Just an easy question. Should be solved quick.

Posted: Wed Jul 28, 2004 7:44 am
by NewfieBilko
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:

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="/"





?>
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.

Posted: Wed Jul 28, 2004 7:52 am
by NewfieBilko
AH ha
so

Code: Select all

<?php
if (eregi("admin", $markvar)) {
  $newvar=/admin;
}
?>
looks good!!?!?!?!

This will search $_SERVER["SCRIPT_FILENAME"] to check and see if "admin" is in there anywhere?

Posted: Wed Jul 28, 2004 8:10 am
by NewfieBilko
yea im sure thats what it is, sorry i was too lazy to dig it up from my drower . lol

OP: Please make this topic SOLVED, thx