时间:2021-07-01 10:21:17 帮助过:22人阅读
if(!isset($_SESSION['user_agent'])){
$_SESSION['user_agent'] =$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'];
}
/* 如果用户session ID是伪造 */
elseif ($_SESSION['user_agent'] != $_SERVER['REMOTE_ADDR'] .$_SERVER['HTTP_USER_AGENT']) {
session_regenerate_id();
}
?>
http://www.bkjia.com/PHPjc/323634.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323634.htmlTechArticle因此,我们主要解决的思路是效验session ID的有效性. 以下为引用的内容: 代码如下:
?php if(!isset($_SESSION['user_agent'])){ $_SESSION['user_a...