찾다
php教程php手册PHP程序防止ddos,dns,集群服务器攻击

PHP程序防止ddos,dns,集群服务器攻击

Jun 13, 2016 am 09:42 AM
ddosdnsphp암호공격섬기는 사람파편프로그램예방하다무리

代码片段(1)

[代码] ddos,dns,集群服务器攻击QQ33258影子可以测试满意担保

view source print? 001   002 <?php 003   004 //查询禁止IP 005   006 $ip =$_SERVER['REMOTE_ADDR']; 007   008 $fileht=".htaccess2"; 009   010 if(!file_exists($fileht))file_put_contents($fileht,""); 011   012 $filehtarr=@file($fileht); 013   014 if(in_array($ip."\r\n",$filehtarr))die("Warning:"."<br>"."Your IP address are forbided by some reason, IF you have any question Pls emill to shop@mydalle.com!"); 015   016   017   018 //加入禁止IP 019   020 $time=time(); 021   022 $fileforbid="log/forbidchk.dat"; 023   024 if(file_exists($fileforbid)) 025   026 if($time-filemtime($fileforbid)>60)unlink($fileforbid); 027   028 else{ 029   030 $fileforbidarr=@file($fileforbid); 031   032 if($ip==substr($fileforbidarr[0],0,strlen($ip))) 033   034 { 035   036 if($time-substr($fileforbidarr[1],0,strlen($time))>600)unlink($fileforbid); 037   038 elseif($fileforbidarr[2]>600){file_put_contents($fileht,$ip."\r\n",FILE_APPEND);unlink($fileforbid);} 039   040 else{$fileforbidarr[2]++;file_put_contents($fileforbid,$fileforbidarr);} 041   042 } 043   044 } 045   046 } 047   048 //防刷新 049   050 $str=""; 051   052 $file="log/ipdate.dat"; 053   054 if(!file_exists("log")&&!is_dir("log"))mkdir("log",0777); 055   056 if(!file_exists($file))file_put_contents($file,""); 057   058 $allowTime = 120;//防刷新时间 059   060 $allowNum=10;//防刷新次数 061   062 $uri=$_SERVER['REQUEST_URI']; 063   064 $checkip=md5($ip); 065   066 $checkuri=md5($uri); 067   068 $yesno=true; 069   070 $ipdate=@file($file); 071   072 foreach($ipdate as $k=>$v) 073   074 { $iptem=substr($v,0,32); 075   076 $uritem=substr($v,32,32); 077   078 $timetem=substr($v,64,10); 079   080 $numtem=substr($v,74); 081   082 if($time-$timetem 083   084 if($iptem!=$checkip)$str.=$v; 085   086 else{ 087   088 $yesno=false; 089   090 if($uritem!=$checkuri)$str.=$iptem.$checkuri.$time."1\r\n"; 091   092 elseif($numtem"\r\n"; 093   094 else 095   096 { 097   098 if(!file_exists($fileforbid)){$addforbidarr=array($ip."\r\n",time()."\r\n",1);file_put_contents($fileforbid,$addforbidarr);} 099   100 file_put_contents("log/forbided_ip.log",$ip."--".date("Y-m-d H:i:s",time())."--".$uri."\r\n",FILE_APPEND); 101   102 $timepass=$timetem+$allowTime-$time; 103   104 die("Warning:"."<br>"."Sorry,you are forbided by refreshing frequently too much, Pls wait for ".$timepass." seconds to continue!"); 105   106 } 107   108 } 109   110 } 111   112 } 113   114 if($yesno) $str.=$checkip.$checkuri.$time."1\r\n"; 115   116 file_put_contents($file,$str); 117   118 ?>
성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

VSCode Windows 64비트 다운로드

VSCode Windows 64비트 다운로드

Microsoft에서 출시한 강력한 무료 IDE 편집기

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

SecList

SecList

SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.

SublimeText3 영어 버전

SublimeText3 영어 버전

권장 사항: Win 버전, 코드 프롬프트 지원!

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구