思路是:通过记录IP来实现。一个文件记录禁止的IP,一个文件,记录这个IP的访问网站的情况,如果符合禁止的条件,就把这个IP加到禁止IP的文件中。

<?php  
//查询禁止IP  
$ip =$_SERVER['REMOTE_ADDR'];  
$fileht=".htaccess2";  
if(!file_exists($fileht))file_put_contents($fileht,"");  
$filehtarr=@file($fileht);  
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!");  

//加入禁止IP  
$time=time();  
$fileforb>file_put_contents($file,$str);  

 原来:http://www.phpchina.com/archives/view-42423-1.html

相关文章:

  • 2021-08-27
  • 2021-12-12
  • 2021-11-17
  • 2021-06-08
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-15
猜你喜欢
  • 2021-12-22
  • 2021-12-25
  • 2021-12-04
  • 2021-06-29
  • 2021-11-17
  • 2022-02-07
  • 2021-12-05
相关资源
相似解决方案