Shared ip

Status
Not open for further replies.

anth_199360

New Member
Messages
2
Reaction score
0
Points
0
is this a problem with my site or the host?
every user has the same ip, and i dont know who is who
can it be changed on the host?
or can i do something with my site,
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
No, IP cannot be changed.
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
If you are saying that one of your scripts checks the IP of your users, and that the script shows all the same IPs, then that is a result of the load distributing setup that x10hosting uses for their servers.

PHP, try using:

HTTP_X_FORWARDED_FOR
HTTP_X_REAL_IP
 
Last edited:

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Note that both come from the X-Forwarded-For and X-Real-IP HTTP headers, respectively, and can thus be spoofed. It shouldn't matter when using the load balancing server (since they'll add the clients real IP to the headers), but if you ever migrate your code to another server that doesn't use proxied load balancing, you could be opening a hole in your security. Just to be safe, you might want to combine both the real and forwarded remote addresses.

PHP:
function remoteAddr() {
    static $remote_addr = null;
    if (is_null($remote_addr)) {
        $remote_addr = $_SERVER['REMOTE_ADDR'];
        foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP') as $hdr) {
            if (isset($_SERVER[$hdr])) {
                $remote_addr .= '/' . $_SERVER[$hdr];
                break;
            }
        }
    }
    return $remote_addr;
}

This won't help you with load-balanced proxies that the client might use, as the remote address might vary with each request, which will appear to be a hijack attempt.
 
Last edited:
Status
Not open for further replies.
Top