代码安全隐患(散分)
刚发现自己写的一段验证代码有严重的安全隐患,请大家指教。代码的目的是先通过判断SESSION变量是否注册及其值是否合法,如果验证失败就跳转到登录页面,如果成功才继续往下执行:
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
session_start();
//$_SESSION['gid'] 是用户登录成功时注册的变量,值1代表管理员组
if (!isset($_SESSION['gid']) || ($_SESSION['gid'] != 1)) {
header("location:login.php?".SID);
}
//do some thing here
?>
<?php header("Location: http://www.example.com/"); /* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
?><div class="clear"></div>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号