Link to home
Start Free TrialLog in
Avatar of LikeLearn
LikeLearn

asked on

HIde HTTP_REFERER

I have dynamically created page (url/firstpage.php
) with link to second page (url/firstpage.php).
when i am echo $HTTP_REFERER from second page i am get (url/firstpage.php). How i can hide $HTTP_REFERER from second page.



Avatar of jimmy282
jimmy282
Flag of United Kingdom of Great Britain and Northern Ireland image

Whats the question?
Avatar of jlatour
jlatour

Browsers will always send the referer, if they support it (which most popular browsers do).

There is no way to hide what page the link was on that led the browser to the second page.
What's the problem ?
Don't echo it :)
You can do this:

unset($HTTP_REFERER);
Avatar of LikeLearn

ASKER

I can't do anything in second script.
I need solve this problem by modifying only first
you see, LikeLearn, the HTTP_REFERER variable is *not* sent by PHP, instead, it is sent by the browser (see jlatour's comment).
Can i simulate browser from first script?
And post different HTTP_REFERER
Yes you can... let's say file1.html calls script2.php, well instead of calling it like this: <A HREF="script2.php">, you call it like this:

<A HREF="script2.php?HTTP_REFERER=">

that way, $HTTP_REFERER won't contain anything

or, <A HREF="script2.php?HTTP_REFERER=Hello">

$HTTP_REFERER will now contain Hello
explain why you don't want to have the http_referer into the second script
to: Dragon Slayer
I try your advice and it's doesn't work
HTTP_REFERER always contains script1.php not "Hello"
same idea

page1.php
<A HREF="script2.php?ref=hello">Test</a>

page2.php
<?
if (isset($ref))
{   $HTTP_REFERER = $ref;
    print $HTTP_REFERER;
}
?>

ASKER CERTIFIED SOLUTION
Avatar of jlatour
jlatour

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jlatour

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

aolXFT
EE Cleanup Volunteer