2 IP are stored for a visitor : PROXY ?
- by Tristan
Hello,
on my database i've decided to store IP of the visitors who answoers to polls.
It's all working, but there is only 2 cases where not only 1 IP is stored, but there is 2 SAME ip for the same visitor
MySQLL output (i replaced 2 numbers by XX)
10.188.XX.129, 10.188.XX.129
Here's the script to recieve the IP of the visitor :
<?php
function realip() {
if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} elseif (isset($_SERVER["HTTP_CLIENT_IP"])) {
$realip = $_SERVER["HTTP_CLIENT_IP"];
} else {
$realip = $_SERVER["REMOTE_ADDR"];
}
} else {
if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$realip = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
$realip = getenv( 'HTTP_CLIENT_IP' );
} else {
$realip = getenv( 'REMOTE_ADDR' );
}
}
return $realip;
}
?
Thanks