RE: [PHP-WIN] http referer
| From: | Igor Portnoy | Date: | Mon, 21 Jul 2003 18:26:21 +0000 |
| Subject: | RE: [PHP-WIN] http referer | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-20853@lists.php.net to get a copy of this message | ||
Jon,
Try this:
if (($_SERVER[HTTP_REFERER] == "") || ($_SERVER[HTTP_REFERER] !=
"http://your_domain/your_file_name")){
echo "You came from different page or tried to open this file
directly!";
}else {
echo "You came from my page";
}
Take care,
Igor P.
-----Original Message-----
From: Jon Phipps [mailto:lordpuma@shaw.ca]
Sent: Monday, July 21, 2003 11:03 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] http referer
I am having no end of bad luck getting the refering page returned, the
issue
may be that I am doing redirects using javascript if a document is not
loaded correctly.
//
// test and redirect if needed
//
<script language="JavaScript" >
<!--/
if (window != parent) top.location.href = location.href;
function checkref() {
if (document.referrer !=
("http://groups.msn.com/CastleOfDarkDesiresDreams/annex.msnw"))
window.location =
"http://coddad.thepumas.net/errors/403-50.php";
}
//-->
</script>
How would i get the page that sent someone to the error screen?? Both
the
$_SERVER and getenv calls to HTTP_REFERER return either empty or
something
undefined..
this code has no effect with or without the getenv capitalized
$refpage=GETENV('HTTP_REFERER');
if ($repage = ""){
$refpage="Direct Hit";
}
and if I try the same thing but with
$refpage=$_SERVER["HTTP_REFERER"];
if ($repage = ""){
$refpage="Direct Hit";
}
I get the following notice on the screen when the script is run
Notice: Undefined index: HTTP_REFERER in E:\coddad\errors\403-50.php on
line
28
regards
Jon
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php