Home >Backend Development >PHP Tutorial >PHP anti-malicious refresh implementation code_PHP tutorial

PHP anti-malicious refresh implementation code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:37:29766browse

Copy 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;
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321927.htmlTechArticleCopy the code as follows: ?php session_start(); $k=$_GET['k']; $t =$_GET['t']; $allowTime = 1800;//Anti-refresh time $ip = get_client_ip(); $allowT = md5($ip.$k.$t); if(!isset($_SESS.. .
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