CruzIT
Saturday March 23, 2019 - 11:31:19 AM

Registered Linux User #440901    


 
Login    Register
Login Required

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 41.193.5.52] PHP Notice: Undefined index: REMOTE_HOST in /var/www/yourdirectory/somepage.php on line 10
[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.

“Windows - Just Say No”

Time since last reboot: 4 days, 4 hours, 51 minutes, 4 seconds

Page generated in zero point nine zero (0.90) seconds.

@ Active Member Project Honeypot  email addresses

This page was last modified on 09/1/18 @ 10:33:50:pm
This file name: info_php_errors.php

Questions, Comments, Suggestions or Requests should be sent to:  ronnie@cruzit.com 

There have been  84460  Unique Visitors (IP Addresses) to this site.

Current users online : 24
Maximum users at a time : 50
Last 25 attacks have come from:
14.248.137.211
157.55.39.224
209.97.138.189
185.227.111.133
40.77.167.119
195.201.141.210
45.77.106.13
146.71.77.244
45.119.212.150
104.198.63.244
52.87.182.94
23.228.81.10
188.166.80.133
91.134.248.235
52.78.241.165
175.126.62.28
192.42.116.16
46.229.168.142
188.126.73.10
103.59.38.130
192.200.215.90
176.31.124.223
183.90.250.38
159.65.146.132
138.197.46.78

There are currently 25 unique IP addresses blacklisted.

Public cruzit.com Server Status
server offline limelight  web service
 Aw Crap!, It's Off-Line
server offline limelight  mail service
 Aw Crap!, It's Off-Line
server online www  web service
 Is On-Line
server online mx 08  mail service
 Is On-Line
server online www01  F/O web service
 Is On-Line
server online mx 09  mail service
 Is On-Line
server online tertiary  DNS service
 Is On-Line
server online mx 10  mail service
 Is On-Line

©Copyright 2004-2019 - cruzit.com - Redd Enterprises™, Inc.,  All Rights Reserved.
Ubuntu® is a registered trademark of Canonical Ltd.
Linux® is a registered trademark of Linus Torvalds.
Apache® is a registered trademark of The Apache Software Foundation.
PHP® is a registered trademark of The PHP Group.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other product and service names mentioned are the trademarks of their respective companies.

 

pretrial
pretrial
pretrial
pretrial
Let us know what you think! finance@homelandcomputersecurity.com