RE: [PHP] Problem with the HTTP_REFERER

From: Date: Fri, 27 Apr 2001 10:12:14 +0000
Subject: RE: [PHP] Problem with the HTTP_REFERER
Groups: php.general 
Request: Send a blank email to php-general+get-50590@lists.php.net to get a copy of this message
My interpretation of the problem is: You want a link on page A.php which points to B.php, B.php does some stuff, then redirects the user to page C.php You want the value of HTTP_REFERER on page C.php to be A.php Correct? If so, read on, if not, then delete this email. I'm using php-4.0.4pl1, apache 1.3.14, IE5.5, win2000, and this works on my system. My two solutions both use the following 2 files : [index.html] <HTML> <HEAD> <TITLE>Test</TITLE> </HEAD> <BODY> <A HREF="test.php" target="_blank">Click here</A> </BODY> </HTML> [targetpage.php] <HTML> <HEAD> <TITLE>targetpage.php</TITLE> </HEAD> <BODY> You came to this page from "<?php echo $HTTP_REFERER;?>" </BODY> </HTML> Solution 1: Use the php function "header" (http://www.php.net/manual/en/function.header.php) [test.php] <?php //... do stuff $web= "http://localhost/referer_test/targetpage.php"; header ("Location: ".$web); ?> ------------------- Solution 2: Pass HTTP_REFERER in the URL: This also works on my system, but isn't exactly the neatest of methods. [test.php] <HTML> <HEAD> <TITLE>test.php</TITLE> </HEAD> <BODY> <?php $web= "localhost/referer_test/targetpage.php"; $web= $web."?HTTP_REFERER=".$HTTP_REFERER; //pass HTTP_REFERER in the URL echo "<SCRIPT language=\"javascript\">window.location.href=\"http://$web\"</script>"; ?> </BODY> </HTML> Hope that helped, Simon. > -----Original Message----- > From: Rosen [mailto:rosen_dm@dir.bg] > Sent: Friday, April 27, 2001 07:56 > To: php-general@lists.php.net > Subject: Re: [PHP] Problem with the HTTP_REFERER > > > Is anybody knows how can I redirect to another page > and the REFERER to another page to be my page ? > > Thanks, > Rosen Marinov ... snip ...

« previous php.general (#50590) next »