Home >Backend Development >PHP Tutorial >Anti-malicious click system PHP anti-malicious refresh implementation code
Copy the code The code is as follows:
session_start();
$k=$_GET['k'];
$t=$_GET['t'];
$allowTime = 1800; // Anti-refresh time
$ip = get_client_ip();
$allowT = md5($ip.$k.$t);
if(!isset($_SESSION[$allowT]))
{
$refresh = true;
$_SESSION[$allowT] = time();
}elseif(time() - $_SESSION[$allowT]>$allowTime){
$refresh = true;
$_SESSION[$allowT] = time ();
}else{
$refresh = false;
}
?>
The above introduces the anti-malicious click system PHP anti-malicious refresh implementation code, including the content of the anti-malicious click system. I hope it will be helpful to friends who are interested in PHP tutorials.