嗨即时尝试将一个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