XAMPP 5.6.3-0 on Mac. Following errors are displayed instead of file manager front page.
Notice: Undefined index: HTTP_CLIENT_IP in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 64
Notice: Undefined index: HTTP_X_FORWARDED_FOR in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 65
Notice: Undefined index: HTTP_X_FORWARDED in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 66
Notice: Undefined index: HTTP_FORWARDED_FOR in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 67
Notice: Undefined index: HTTP_FORWARDED in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 68
Notice: Undefined index: HTTPS in /Applications/XAMPP/xamppfiles/htdocs/fm.php on line 81
Fix diff:
David-Newcombs-MacBook-Pro:xampp davidnewcomb$ diff -u fm.php fm-fixed.php
--- fm.php 2015-01-28 04:14:36.000000000 +0000
+++ fm-fixed.php 2015-01-28 04:14:43.000000000 +0000
@@ -61,12 +61,12 @@
// Server Vars
function get_client_ip() {
$ipaddress = '';
- if ($_SERVER['HTTP_CLIENT_IP']) $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
- else if($_SERVER['HTTP_X_FORWARDED_FOR']) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
- else if($_SERVER['HTTP_X_FORWARDED']) $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
- else if($_SERVER['HTTP_FORWARDED_FOR']) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
- else if($_SERVER['HTTP_FORWARDED']) $ipaddress = $_SERVER['HTTP_FORWARDED'];
- else if($_SERVER['REMOTE_ADDR']) $ipaddress = $_SERVER['REMOTE_ADDR'];
+ if (isset($_SERVER['HTTP_CLIENT_IP'])) $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
+ else if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
+ else if(isset($_SERVER['HTTP_X_FORWARDED'])) $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
+ else if(isset($_SERVER['HTTP_FORWARDED_FOR'])) $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
+ else if(isset($_SERVER['HTTP_FORWARDED'])) $ipaddress = $_SERVER['HTTP_FORWARDED'];
+ else if(isset($_SERVER['REMOTE_ADDR'])) $ipaddress = $_SERVER['REMOTE_ADDR'];
// proxy transparente não esconde o IP local, colocando ele após o IP da rede, separado por vírgula
if (strpos($ipaddress, ',') !== false) {
$ips = explode(',', $ipaddress);
@@ -78,7 +78,7 @@
$ip = get_client_ip();
$islinux = !(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
function getServerURL() {
- $url = ($_SERVER["HTTPS"] == "on")?"https://":"http://";
+ $url = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")?"https://":"http://";
$url .= $_SERVER["SERVER_NAME"]; // $_SERVER["HTTP_HOST"] is equivalent
if ($_SERVER["SERVER_PORT"] != "80") $url .= ":".$_SERVER["SERVER_PORT"];
return $url;
Sorry forgot to mention: phpFileManager 0.9.8
Thanks David. The new version 1.2 i think has this fixed. Please reply if not so.
The script is old, and it set error reporting to not show NOTICES, only ERRORS. It works and i dont want to re-write the whole thing.