PHP anti-malicious refresh implementation code_PHP tutorial

WBOY
Release: 2016-07-21 15:37:29
Original
741 people have browsed it

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.. .
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template