10-13-2009, 05:55 PM
You can improve it a bit by including $_SERVER['HTTP_X_FORWARD_FOR'] variable, if the user is trying to use a proxy which has been configured to allow this server variable
So,
Thanks for sharing, it will be useful
So,
PHP Code:
if ($_SERVER['HTTP_X_FORWARD_FOR']) {
$ip_user = $_SERVER['HTTP_X_FORWARD_FOR'];
} else {
$ip_user = $_SERVER['REMOTE_ADDR'];
}
Thanks for sharing, it will be useful