Re: how to use HTTP_REFERER

From: Date: Fri, 06 Aug 2004 07:48:53 +0000
Subject: Re: how to use HTTP_REFERER
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192971@lists.php.net to get a copy of this message
On 06/08/2004, at 2:43 PM, khuram noman wrote:
hi i have 2 pages on my site one is index.php and other is join.php on index page there is link of join now when somee one comes to join now page i want to know from where it comes i means i want to know the referral page . iam using $HTTP_SERVER_VARS['HTTP_REFERER'] or $_SERVER['HTTP_REFERER'] but both are not working . iam using php version 4.3.3 is there any server settings required to use these arrays but $_post[] array is working. waiting for ur soon reply
Khuram, Let's try a little debugging... Create a file called test.php on your server with this mark-up: <html> <head>
    <title>PHP SERVER TEST</title>
</head> <body>
    <p>
      <a href='test.php'>click</a>
    </p>
    <pre>
      <? print_r($_SERVER); ?>
    </pre>
</body> </html> This will dump the contents of _SERVER onto the screen. When you first load the page, there SHOULD be a lot of values on the screen, but if there isn't, then there's definitely something odd with your server set-up. If there ARE a lot of values on the screen, great, good start. You'll will notice that there ISN'T a value for for HTTP_REFERER, because so far there isn't a referrer (you accessed the page direct). Click on the "click" link, and the page will reload with the _SERVER array again, and this time there *should* be a value in the HTTP_REFERER. If there isn't, then I'd suggest wither your browser, firewall, virus protection software or your server is messing around with referrers for security or privacy reasons. Good luck, --- Justin French http://indent.com.au

« previous php.general (#192971) next »