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:[EMAIL PROTECTED]]
> Sent: Friday, April 27, 2001 07:56
> To: [EMAIL PROTECTED]
> 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 ...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to