game/_incl_data/class/User/UserIp.php

18 lines
446 B
PHP
Raw Normal View History

2022-12-19 20:22:19 +00:00
<?php
namespace User;
2022-12-19 20:22:19 +00:00
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';
}
}