CruzIT
Saturday September 07, 2024 - 3:54:28 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: 43 days, 11 hours, 47 minutes, 11 seconds

Page generated in zero point five six (0.56) 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  17666  Unique Visitors (IP Addresses) to this site.

Current users online : 16
Maximum users at a time : 60
Last 25 attacks have come from:
85.192.41.110
45.63.83.161
66.70.181.5
45.77.6.159
103.153.214.173
15.237.180.153
147.78.47.62
51.222.44.176
51.15.184.67
45.32.92.198
13.233.249.140
149.28.250.196
107.189.11.116
85.190.242.220
145.239.10.137
91.239.208.148
62.169.29.121
45.63.90.95
68.178.166.166
45.76.18.208
155.138.243.173
36.255.3.63
13.39.19.34
159.65.227.65
35.180.242.121

There are currently 25 unique IP addresses blacklisted.

Public cruzit.com Server Status
server online dbc001  db cluster service
 Is On-Line
server offline www03  web service
 Aw Crap!, It's Off-Line
server online www  web service
 Is On-Line
server offline mx 08  mail service
 Aw Crap!, It's Off-Line
server offline www ha  F/O web service
 Aw Crap!, It's Off-Line
server offline mx 11  mail service
 Aw Crap!, It's Off-Line
server online Primary  Client DNS
 Is On-Line
server online Secondary  Client DNS
 Is On-Line

©Copyright 2004-2024 - 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.
The MariaDB® a registered trademark of the MariaDB Corporation Ab.
MySQL® is a registered trademark of the Oracle Corporation Inc.
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