0
点赞
收藏
分享

微信扫一扫

php 防止恶意刷新

扒皮狼 2023-01-31 阅读 83


<?php 
session_start();
$k=$_GET['k'];
$t=$_GET['t'];
//防刷新时间
$allowTime = 1800;
$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;
}
?>

举报

相关推荐

0 条评论