php代码中如何实现禁止某个ip段访问网站的指定的某篇文章
//地区限制
if($config['area']!=='全国'){
require('ipclass.php');
$iplocation = new IpLocation();
$location = $iplocation->getlocation($ip);
$country=to_utf8($location['country']);
$config_country=$config['area'].$config['city'];
$country2=str_replace('地区','',$config_country);
if($country!==$country2){
exit('您的地区IP不在此文章浏览范围之内,禁止浏览');
}
}
这个代码是限制注册ID 用的 想把这个代码嵌入到文章里面,文章的数据表中也添加了area(省) city(城市)两个字段
代码中ipclass.php可以获取浏览者ip
如何实现与数据库中一篇文章的地区对比呢,config是源码里面的一个文件 不能从这调取 想从数据库中调取