PHP Error Information
This area is for finding and fixing errors when developing PHP applications.
The main focus here will be PHP5.
You have your php applications running and doing the magic you
wanted. If you haven't already read the article about checking for
php errors and warnings, do it now.
If something like the following shows up in your apache error.log:
[error] [client 83.19.92.133] PHP Notice: Undefined index: HTTP_USER_AGENT in /var/www/yourdirectory/somepage.php on line 14
The fix for this kind of error is:
if(isset($_SERVER['REMOTE_HOST'])) { $remotehost = trim($_SERVER['REMOTE_HOST']); } elseif (isset($_SERVER['REMOTE_HOST'])) { $remotehost = base64_encode($_SERVER['REMOTE_HOST']); } else { $remotehost = "was empty"; } if(isset($_SERVER['HTTP_USER_AGENT'])) { $uagent = trim($_SERVER['HTTP_USER_AGENT']); } elseif (isset($_SERVER['HTTP_USER_AGENT'])) { $uagent = base64_encode($_SERVER['HTTP_USER_AGENT']); } else { $uagent = "was empty"; } if(isset($_SERVER['HTTP_REFERER'])) { $referer = trim($_SERVER['HTTP_REFERER']); } elseif (isset($_SERVER['HTTP_REFERER'])) { $referer = base64_encode($_SERVER['HTTP_REFERER']); } else { $referer = "was empty"; }
The above examples are for some of the more common ones like User Agent, Referrer and Remote Host names. All three can be missing, wrong or spoofed. Make sure you are not depending solely on any of them for any critical functionality.
If you would like some information on how to do something use the Contact Page. Someone will get back with you with an answer.