function getClientIP () {
if (isset ($_SERVER ['HTTP_X_FORWARDED_FOR'])){
$clientIP = $_SERVER ['HTTP_X_FORWARDED_FOR'];
}
elseif (isset ($_SERVER ['HTTP_X_REAL_IP'])){
$clientIP = $_SERVER ['HTTP_X_REAL_IP'];
}
else {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
return $clientIP;
}