嗨即時嘗試將一個if語句,說登錄後,如果用戶帳戶被禁止,然後重定向到logout.php記錄用戶出,但我也想在這種情況發生後顯示會話消息。可以這樣做,即時嘗試執行以下操作,但只能將用戶重定向到註銷並登出,而不顯示會話消息。如果條件爲真重定向到註銷並顯示會話消息?
請能有人告訴我在哪裏,我去錯了感謝:
<? if (logged_in()) { ?>
<?
$account_banned = account_banned();
while ($banned = mysql_fetch_array($account_banned))
if ($banned['account_banned'] == '1') {
$_SESSION['banned']="<div class=\"infobox-noprofile\"><strong>Account Banned</strong> - We could not log you in because your account has been banned. If you need to talk to us about this please email <a href=\"mailto:[email protected]\">[email protected]</a></div><div class=\"infobox-close12\"></div>";
redirect_to("logout.php");
?>
<? } }?>
在logout.php
:
<?
session_start();
if(isset($_SESSION['banned']))
echo $_SESSION['banned'];
unset($_SESSION['banned']);
?>
'redirect_to'做了什麼? – 2013-02-12 19:05:37
你缺少session_start();在第一頁 – Nimrod007 2013-02-12 19:08:00