function getip(){
static $ip = null;
if($ip !=null) return $ip;
if(getenv('REMOTE_ADDR')) $ip = sprintf('%u',ip2long(getenv('REMOTE_ADDR')));
elseif(getenv('HTTP_CLIENT_IP')) $ip = sprintf('%u',ip2long(getenv('HTTP_CLIENT_IP')));
elseif(getenv('HTTP_X _FORWARAED_FOR')) $ip = sprintf('%u',ip2long(getenv('HTTP_X _FORWARAED_FOR'))); return $ip;
}