In some cases that router translate/convert the client information when forward all the packet to the server, PHP does not return correct client IP address by $_SERVER['REMOTE_ADDR']. In that case, the original client information is saved in HTTP_X_FORWARDED_FOR. Below code shows how to get the correct client IP address in PHP.

$ipAddress = $_SERVER['REMOTE_ADDR'];
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
    $ipAddress = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
}

Below page has more detailed/correct way to get client information