detecting php file

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
psurrena
Forum Contributor
Posts: 355
Joined: Thu Nov 10, 2005 12:31 pm
Location: Broolyn, NY

detecting php file

Post by psurrena »

I want to use a different background image on certain pages. How do I detect the /greatpage.php? Basically what HTTP_REFER leaves out.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

HTTP_REFERER shows the last page you browsed.
What about PHP_SELF or REQUEST_URI?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

__FILE__ is probably better to use. It's certainly safer than PHP_SELF.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

feyd wrote:__FILE__ is probably better to use. It's certainly safer than PHP_SELF.
Yes. But only if we don't use mod_rewrite.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Gente wrote:Yes. But only if we don't use mod_rewrite.
With mod_rewrite, one is on their own as they should be able to figure it out. ;)
Post Reply