game/_incl_data/class/User/UserIp.php

18 lines
446 B
PHP

<?php
namespace User;
class UserIp
{
public static function get()
{
return $_SERVER['HTTP_CLIENT_IP']
?? $_SERVER["HTTP_CF_CONNECTING_IP"] # when behind cloudflare
?? $_SERVER['HTTP_X_FORWARDED']
?? $_SERVER['HTTP_X_FORWARDED_FOR']
?? $_SERVER['HTTP_FORWARDED']
?? $_SERVER['HTTP_FORWARDED_FOR']
?? $_SERVER['REMOTE_ADDR']
?? '0.0.0.0';
}
}