gpt4 book ai didi

PHP session 问题

转载 作者:行者123 更新时间:2023-12-02 06:11:41 27 4
gpt4 key购买 nike

我遇到了一个我一生都无法解决的问题。我已经为客户设置了一个 super 简单的 CMS。 CMS 的每个不同页面都有并包含名为 session.php 的文件。

session_start(); 
$username = $_SESSION['siteadmin'];
if (!$_SESSION['siteadmin']){
header( 'Location: login.php?status=2' );
}

时不时地,随机的东西会从数据库中消失。因此,我设置了一个粗略的日志系统,通过 CMS 记录任何操作。好吧,它又发生了。日志显示:

Logged in                           **.**.237.209   17:18  <-- thats me
Deleted board member id 12 195.42.102.25 16:49
Deleted board member id 15 195.42.102.25 16:49
Deleted board member id 8 195.42.102.25 16:49
Deleted board member id 10 195.42.102.25 16:49
Deleted board member id 9 195.42.102.25 16:49
Deleted board member id 4 195.42.102.25 16:49
Deleted board member id 3 195.42.102.25 16:49
Deleted board member id 5 195.42.102.25 16:49
Deleted board member id 6 195.42.102.25 16:49
Deleted board member id 11 195.42.102.25 16:49
Deleted board member id 7 195.42.102.25 16:49
Deleted review id 2 195.42.102.25 16:49
Deleted review id 3 195.42.102.25 16:49

这持续了几页。它甚至不显示 195.42.102.25 登录!上次发生在 195.128.18.19。他们的计算机如何在没有 session 变量的情况下加载窗口?我的代码中是否存在我完全忽略的安全漏洞?!

对这个问题的任何见解都会很棒。

谢谢,

最佳答案

header 之后放置一个 exit

关于PHP session 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2011862/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com