2 IP are stored for a visitor : PROXY ?

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2010-05-07T08:25:29Z Indexed on 2010/05/07 8:38 UTC
Read the original article Hit count: 133

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql