我按照以下步驟設置了會話,因爲echo會出現,所以這是有效的。但是當我進入下一頁或另一頁時,會話不在那裏?我究竟做錯了什麼?正在丟失Php會話
$session_start();
if ($username==$dbusername&&$password==$dbpassword)
{
echo"<b>Login Successful</b><br><a href='systemadmin.html'><br>Click here to access the <strong>System Admin Page</strong></a>";
$_session['username']=$dbusername;
if($username == "admin")
{
$_session['admin'] = true;
}
我試圖讓下面的這些會議的工作:
<?php
session_start();
if($_session['admin'] == true)
{
// do nothing
}else{
header('Location: home.html') ;
}
?>
更新:
大寫會議工作,但現在的會話了摧毀的arent當我使用logout.php
<?php
session_start();
session_destroy();
header("location: home.html");
?>
這個工程,但我有一個新問題 – Anicho
@Anicho看到我的更新 – PeeHaa
謝謝repwhoringpeehaa – Anicho