DamienRoche Posted September 13, 2008 Share Posted September 13, 2008 To clarify, can I detect what page the browser was on before it started running the script? like: header(location:blah); /////but what it WAS Any ideas? Thanks. Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/ Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 It can be forged and some browsers don't set it. If you really want to use it though, it's located at $_SERVER['HTTP_REFERER']. Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/#findComment-640510 Share on other sites More sharing options...
DamienRoche Posted September 13, 2008 Author Share Posted September 13, 2008 Hey thanks!! this is problem though, it's browser specific. With the application I'll be using I don't need to worry about that. Thanks! Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/#findComment-640513 Share on other sites More sharing options...
DamienRoche Posted September 13, 2008 Author Share Posted September 13, 2008 Just thought. Is it possible to do this on a server level? Like say I have two scripts: script1.php script2.php and in script1.php I INCLUDE script2.php....can I determine within script2 that it was included in script1? Thanks. Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/#findComment-640520 Share on other sites More sharing options...
Stooney Posted September 13, 2008 Share Posted September 13, 2008 In script 1 add a variable like $in_script1=true; then in script 2 check for that variable script 1 $in_script1=true; script 2 if(!$in_script1){ exit(); } Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/#findComment-640615 Share on other sites More sharing options...
PFMaBiSmAd Posted September 13, 2008 Share Posted September 13, 2008 If you are trying to determine on your site what page someone came from, use a session variable (set it to a value or string that indicates each page and check it on the next page.) If you are trying to require someone to get to a page after some initial page (like a login), you should be using sessions anyway to indicate they are logged in. Link to comment https://forums.phpfreaks.com/topic/124067-can-you-detect-where-a-browser-was-before-it-got-to-php-page/#findComment-640634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.