实例:PHP判断用户是否正确登录转到欢迎界面

80酷酷网    80kuku.com

  

<?php
//这个页面首先判断用户是否正确登录,如未登录,就转到登录页面。
session_start();
if((!$user_id)or(!$user_array[ticket_day])or(!$user_array[ticket_num])){
    Header("Location: login.php3");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>欢迎使用南京站订票系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../include/njz_common.css">
</head>

<body>
<p> </p>
<table width="500" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#CCCCCC">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr bgcolor="#999999">
          <td>
            <div align="center"><font size="4" color="#FFFFFF">欢迎您 <?php echo $user_name; ?></font></div>
          </td>
        </tr>
      </table>
     

      <table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td><font color="#3333CC">公告栏:</font></td>
        </tr>
        <tr>
          <td>  今日无公告</td>
        </tr>
      </table>
     

     

      <table width="400" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
          <td>
            <div align="center"><a href="reserve_ticket.php3">网上订票</a> <a href="test1.php3">订单查询</a> <a href="test2.php3">口令修改</a> 订票帮助 <a href="login.php3?logout=1">退出登录</a> </div>
          </td>
        </tr>
      </table>
     

    </td>
  </tr>
</table>
<p> </p>
<?php
include("../footer.php");
?>
</body>
</html>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: