Copy code The code is as follows:
//Exit the proxy IP directly
empty( $_SERVER['HTTP_VIA']) or exit('Access Denied');
//Prevent fast refresh
session_start();
$seconds = '3'; //Time period [seconds]
$refresh = '5'; //Number of refreshes
//Set monitoring variables
$cur_time = time();
if(isset($_SESSION['last_time'])){
$_SESSION['refresh_times'] += 1;
}else{
$_SESSION['refresh_times'] = 1;
$_SESSION['last_time'] = $cur_time;
}
//Process monitoring results
if($cur_time - $_SESSION['last_time'] < $seconds){
if($_SESSION['refresh_times'] >= $refresh){
//Jump to the attacker's server address
header(sprintf('Location:%s', 'http://127.0.0.1'));
exit('Access Denied');
}
}else{
$_SESSION['refresh_times'] = 0;
$_SESSION['last_time'] = $cur_time;
}
?>
http://www.bkjia.com/PHPjc/735243.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/735243.htmlTechArticleCopy the code as follows: ?php //Exit the proxy IP directly empty($_SERVER['HTTP_VIA']) or exit('Access Denied'); //Prevent quick refresh session_start(); $seconds = '3'; //Time period [seconds]...