【发布时间】:2022-02-07 12:31:15
【问题描述】:
我正在构建一个登录系统。我的数据库看起来像 this
假设登录后,代码会根据其 KURS 字段中的内容识别当前登录的用户并将其发送到特定网站。
所以用户 yyy 将被发送到 TG111.php
用户 uuu 将被发送到 TG112.php
TG111.php 看起来像这样
<?php
session_start();
$sess = $_SESSION['KURS'];
if ($sess !== 'TG111') {
if ($sess !== 'TG112') {
if ($sess !== 'TG113') {
header("Location: index.php");
exit();
}
else {
header("Location: TG113.php");
exit();
}
}
else {
header("Location: TG112.php");
exit();
}
}
else {
header('Location: TG111.php');
exit();
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Hello</title>
</head>
<body>
<a href="logout.php">Abmelden</a>
</body>
</html>
但这不起作用...
【问题讨论】:
-
尝试设置
$_SESSION['KURS']