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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

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

Post 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.
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post 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?
User avatar
NewfieBilko
Forum Contributor
Posts: 189
Joined: Sun Jun 06, 2004 6:45 pm
Location: Newfoundland
Contact:

Post 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
Post Reply