所以我有以下代码:
$ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR');
$details = json_decode(file_get_contents("http://ipinfo.io/$ip/json"));
if ($details->country == US):
{
echo "We are sorry, We cannot allow users from United States";
die();
}
elseif ($details->country == GB):
{
echo "We are sorry, We cannot allow users from United Kingdom";
die();
{
else:
show index script问题是,一些美国和英国用户仍然可以看到索引
发布于 2017-11-30 22:05:50
看起来您正在与名为US或GB的常量进行比较。您可能想要检查字符串。
$details->country === 'US'。
发布于 2017-11-30 23:33:06
问题出在http://ipinfo.io/$ip/json I get Rate limit exceeded。
https://stackoverflow.com/questions/47575248
复制相似问题