据客户反映,后台短时间无故增加多个垃圾评论,均来自IP188.143.232.*
(1)遂操刀修改 includes/init.php 约90行增加
//Powered By UUECS QQ909065309 HTTP://Www.UUECS.Com $temp=explode(".",real_ip());//获取ip if($temp[0].".".$temp[1].".".$temp[2]=='188.143.232'){//屏蔽你YA die("update..");//提示升级~ } //Powered By UUECS QQ909065309 HTTP://Www.UUECS.Com
修改完毕,你爷爷的,看你还嚣张。这个IP被屏蔽无法访问网站了。~~
(2)当然,垃圾评论还是得删掉的。
登陆后台。SQL查询: delete from ecs_comment where ip_address like ‘188.143.232%’;
(3)查根。查看下服务器日志,访客通过何种手段写入的数据库。比如comment_add.php
(4) 在comment_add.php 写入comment数据前设定个SESSION验证(这个程序在某服务商大部分模板下存在,不严谨)
搜索比如:$sql = “INSERT INTO “.$GLOBALS[‘ecs’]->table(‘comment’)
前增加:
if (!isset($_SESSION['send_time'])) { $_SESSION['send_time'] = 0; } $cur_time = time(); if (($cur_time - $_SESSION['send_time']) < 60) // 小于60秒禁止发评论 { show_message('对不起,服务器很忙,你歇歇好不~');//提示语言自己编了~ }
在写入数据库后更改session值:
如搜索$cmid = $GLOBALS[‘db’]->insert_id();后增加以下代码
$_SESSION[‘send_time’] = $cur_time;
(5)整个过程 10分钟左右,世界突然清净了……
不错不错,很好很好,谢谢分享