<Original message> From: Balaji Ankem <[EMAIL PROTECTED]> Date: Wed, Sep 05, 2001 at 02:05:50AM +0530 Message-ID: <03f301c13581$2fccf8a0$[EMAIL PROTECTED]> Subject: what will be the output for this pgm? > Hi friend, > what will be the output for the following program? > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > <?php > > $foo=$HTTP_SERVER_VARS["HTTP_REFERER"]; > > echo $foo; > > ?> > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > > For me it is printing the blank value. > > Thanks in advance > > Regards > -Balaji </Original message> <Reply> Hi there, Well... it depends on several things. First of all the browser of the user (your browser in this case) should support sending the referer. If it doesn't you tough out of luck. But I believe most browsers _do_ send it. But then... This is the tricky thing about testing these kinds of variables. You musn't call the page directly. Say you have your example in a page called test.php and you just type domain/test.php in your location bar you won't get to see anything. Very simply because there is no referer if you go to the page directly. So you should go there by using some link on a different page. You probably have warning message in your logfile saying that the index HTTP_REFERER is undefined. Working with these kinds of variables takes some more acurate coding. You should always first check whether or not the variable is defined: if (isset ($HTTP_SERVER_VARS["HTTP_REFERER"])) { $foo = $HTTP_SERVER_VARS["HTTP_REFERER"]; echo $foo; } Another tricky thing with using the referer is when users use bookmarks. If they bookmark the page and use that bookmark the next time they want to see the page, you won't get a referer from them. So... you should always check very thoroughly whether or not the referer is defined. And you should never base your authentication on it. Conclusion: Accept for the missing error-checking your code is correct. You should make a diffent page with a link to the page where this code is on and test it by clicking that link. It should work then... Hope this helped you out... </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- «««««««««««««««««««««««« -- 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]