Re: http_referer. what's wrong with that?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 12:27 AM 1/12/2012, Haluk Karamete wrote:
Because I got this

echo $_SERVER['HTTP_REFERER'];

I end up with this

Notice: Undefined index: HTTP_REFERER in
D:\Hosting\5291100\html\blueprint\bp_library.php on line 16
die;

Now, this is of course after the <?php error_reporting (E_ALL); ?>  change.

One solution is to dodge it by

echo @$_SERVER['HTTP_REFERER'];

The better way to avoid the error is to do something like

echo (isset($_SERVER['HTTP_REFERER']))?$_SERVER['HTTP_REFERER']:'No referrer set';

Which checks to see if it's set before echoing the value. If it's not set, you get a message saying so.

Ken



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux