嗨,我试图放置一个 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:support@playtimeboys.com\">Support@PlaytimeBoys.com.</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']);
?>