To determine which script filename called it

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
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

To determine which script filename called it

Post by anjanesh »

There are 3 pages : a.php, b.php, c.php
a.php has a link to c.php
b.php has a link to c.php
Is there any way to find out in c.php which page called it ? Without the use of hidden tags or url paramter. I just need to know the calling script file name.
Thanks
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

$_SERVER['HTTP_REFERER'] will contain the full full refering URL, which you can then analyze and return the refering page

Mark
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

But keep in mind that some browsers have an option to disable referer tracking. For example, Opera does.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's the option of (if allowed) opening the access_log and suck out that ip/host's records in the last minute or something.. :) Although this is defeatable, partly, by anonymizers/proxies
Post Reply