您好,欢迎访问一九零五行业门户网

PHP攻击网站防御代码-以及攻击代码反译_PHP教程

这是我无意中攻击一个网站发现的一个代码php有效的拦截住我的ddos
60)unlink($fileforbid);  
else{  
$fileforbidarr=@file($fileforbid);  
if($ip==substr($fileforbidarr[0],0,strlen($ip)))  
{  
if($time-substr($fileforbidarr[1],0,strlen($time))>600)unlink($fileforbid);  
elseif($fileforbidarr[2]>600){file_put_contents($fileht,$ip.\r\n,file_append);unlink($fileforbid);}  
else{$fileforbidarr[2]++;file_put_contents($fileforbid,$fileforbidarr);}  
}  
}  
}  
//防刷新  
$str=;  
$file=log/ipdate.dat;  
if(!file_exists(log)&&!is_dir(log))mkdir(log,0777);  
if(!file_exists($file))file_put_contents($file,);  
$allowtime = 120;//防刷新时间  
$allownum=10;//防刷新次数  
$uri=$_server['request_uri'];  
$checkip=md5($ip);  
$checkuri=md5($uri);  
$yesno=true;  
$ipdate=@file($file);  
foreach($ipdate as $k=>$v)  
{ $iptem=substr($v,0,32);  
$uritem=substr($v,32,32);  
$timetem=substr($v,64,10);  
$numtem=substr($v,74);  
if($time-$timetem if($iptem!=$checkip)$str.=$v;  
else{  
$yesno=false;  
if($uritem!=$checkuri)$str.=$iptem.$checkuri.$time.1\r\n;  
elseif($numtem else  
{  
if(!file_exists($fileforbid)){$addforbidarr=array($ip.\r\n,time().\r\n,1);file_put_contents($fileforbid,$addforbidarr);}  
file_put_contents(log/forbided_ip.log,$ip.--.date(y-m-d h:i:s,time()).--.$uri.\r\n,file_append);  
$timepass=$timetem+$allowtime-$time;  
die(warning:.
.sorry,you are forbided by refreshing frequently too much, pls wait for .$timepass. seconds to continue!);  
}  
}  
}  
}  
if($yesno) $str.=$checkip.$checkuri.$time.1\r\n;  
file_put_contents($file,$str);  
?> 
http://www.bkjia.com/phpjc/735145.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/735145.htmltecharticle这是我无意中攻击一个网站发现的一个代码php有效的拦截住我的ddos ?php //查询禁止ip $ip =$_server[remote_addr]; $fileht=.htaccess2; if(!file_exists($file...
其它类似信息

推荐信息