zurück zum General (english) | Seiten

pit(R)

29.08.2007, 00:06
 

some problems (General (english))

Hi there
Nice script you have make, i try to see how is working and i have those errors
any ideas, i am with suse10.2 and php5

Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_CLIENT_IP in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 485
Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_X_FORWARDED_FOR in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 488
Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_X_FORWARDED in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 493
Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_FORWARDED_FOR in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 495
Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_FORWARDED in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 497
Aug 28 20:49:24 example.com httpd2-prefork: PHP Notice: Undefined index: HTTP_X_FORWARDED in /home/temp/public_html/home/public_html/spider-trap/functions.php on line 499
....
....

JR-EWING(R)

29.08.2007, 10:17

some problems

Hello,
i think you have activate PHP Notices and the server variables are not available. But no problem. Please edit the functions.php in the spider-trap directory and replace the function getip() with the following code.

/**
* Function to get the right IP because REMOTE_ADDR can be empty
*/
function getip() {

if (isset($_SERVER["HTTP_CLIENT_IP"])) {
if (validip($_SERVER["HTTP_CLIENT_IP"])) {
return $_SERVER["HTTP_CLIENT_IP"];
}
}
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
foreach (explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]) as $ip) {
if (validip(trim($ip))) {
return $ip;
}
}
}

if (isset($_SERVER["HTTP_X_FORWARDED"]) && validip($_SERVER["HTTP_X_FORWARDED"])) {
return $_SERVER["HTTP_X_FORWARDED"];
} elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]) && validip($_SERVER["HTTP_FORWARDED_FOR"])) {
return $_SERVER["HTTP_FORWARDED_FOR"];
} elseif (isset($_SERVER["HTTP_FORWARDED"]) && validip($_SERVER["HTTP_FORWARDED"])) {
return $_SERVER["HTTP_FORWARDED"];
} elseif (isset($_SERVER["HTTP_X_FORWARDED"]) && validip($_SERVER["HTTP_X_FORWARDED"])) {
return $_SERVER["HTTP_X_FORWARDED"];
} else {
return $_SERVER["REMOTE_ADDR"];
}
}


pit(R)

29.08.2007, 15:43

some problems

Thank you i try it and i let you know whats happen


Ähnliche Beiträge
Thema Author Antworten Letzter Beitrag
Installation problemsrybrns421.07.2008, 08:54



zurück zum General (english) | Seiten