The variable $_SERVER['HTTP_REFERER'] is only created if the browser sends a Referer string in it's headers. So the site that you have set as your homepage or the first page you go to does not receive this as a header string as there is no actual referer. It is also worth remembering that it is possible to configure your machine to never send this infomation, commonly happens what using software to cover your tracks.
If the code is not affected and you just want to stop the error from showing in you log files, then you can do one of two things:
1) Check that the variable exists before you use it. (You would need to do this for every reference of the $_SERVER['HTTP_REFERER'] var:
Code: Select all
<?php
if (array_key_exists('HTTP_SERVER', $_SERVER)) {
// Do what you want
}
?>
2) As you would have to do the above for every reference, you may want to just do the following at the begining of your script:
Code: Select all
<?php
if (!array_key_exists('HTTP_SERVER', $_SERVER)) {
$_SERVER['HTTP_SERVER'] = '';
}
?>
Implementing one of the above will prevent you log files filling up.