parse($text); } public static function GetClientIP() { global $HTTP_SERVER_VARS; if (isset($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])) { $ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; } elseif ($HTTP_SERVER_VARS["HTTP_CLIENT_IP"]) { $ip = $HTTP_SERVER_VARS["HTTP_CLIENT_IP"]; } elseif ($HTTP_SERVER_VARS["REMOTE_ADDR"]) { $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"]; } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); } elseif (getenv("REMOTE_ADDR")) { $ip = getenv("REMOTE_ADDR"); } else { $ip = "0.0.0.0"; } return $ip ; } public static function GetServerIP() { $ip = '0.0.0.0'; if (isset($_SERVER)) { if (isset($_SERVER['SERVER_ADDR'])) { $ip = $_SERVER['SERVER_ADDR']; } elseif (isset($_SERVER['LOCAL_ADDR'])) { $ip = $_SERVER['LOCAL_ADDR']; } elseif (isset($_SERVER['SERVER_NAME'])) { return gethostbyname($_SERVER['SERVER_NAME']); } } else { $ip = getenv('SERVER_ADDR'); } return $ip; } }