ID UID Username Full Name Password Rank
0 131037146 DSaidov Денис Саидов PASS Администратор
0 1970687978 LKatzarov Любомир Кацаров PASS Администратор
0 58367315 Admin Георги Гергинов PASS Собственик
这是我的MySQL表; 我想创建一个$ _SESSION来保存当前登录CMS的用户的全名内容。 这是auth.php文件:
<?php
include("sql.php");
session_start();
function Destroy() {
unset($_SESSION['UID']);
unset($_SESSION['USERNAME']);
unset($_SESSION['FULL NAME']);
header("location: index-restricted.php");
}
if(isset($_SESSION['UID']) && isset($_SESSION['USERNAME'])) {
$UID = $_SESSION['UID'];
$username = $_SESSION['USERNAME'];
$qry = mysql_query("SELECT * FROM `users` WHERE `UID` = '$UID' AND `Username` = '$username'");
if(mysql_num_rows($qry) != 1) { Destroy(); }
} else { Destroy(); }?>
提前谢谢。