我用php做了bbs论坛,但发现ip登录用户任意发恶意贴,很恼火,终于找到解决方案,一种登录后台,有超级管理员权限,有一按钮,限制ip登录。
第二种方案,用mysql,读出源代码:
mysql table:
create table user_ip(
user_ipvarchar(15)not null,
primary key(user_ip)
)type=my isam
类使用方法
新建对象
$c=new checkip("mysql主机“,”mysql用户名“,”mysql密码“,”mysql数据库“,”mysql数据库表“)
插入新的禁用ip
if(c->insert ip(127.0.0.1))
echo"yon can not pass"
exit
删除禁用ip
c-<delete ip("127.0.0.1)
检测ip
if c->check(127.0.0.1))
echo "you can not pass"
exit.
转载于:https://blog.51cto.com/7330234/1352905