Home >Backend Development >PHP Tutorial >Anti-malicious click system PHP anti-malicious refresh implementation code

Anti-malicious click system PHP anti-malicious refresh implementation code

WBOY
WBOYOriginal
2016-07-29 08:42:431333browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn