登录时注册一个session,会员可查看页,检查这个sesion是否存在,存在给浏览,不存在不给浏览

解决方案 »

  1.   

    我想sesion会让你头痛的~~呵呵,先在上面的搜索里搜一下session的关键字,一定对你有帮助
      

  2.   

    对首先利用SESSION存在!
    我有这样的程序,个人实现是在后台实现管理,定义普通为1,会员为2,到时间通过session判断是1的话response.write 1.asp是2的话response.write 2.asp
    这样就可以了!
      

  3.   

    可以写两个函数:login.php<?phpfunction login_page($errorMessage)
    {
      // Generate the Login-in page
      ?>
      
      <html>
      <body>
        <h2>Login Page</h2>
        <form method="POST" action="login.php">  <? 
      // Include the formatted error message  if (isset($errorMessage))
        echo 
          "<h3><font color=red>$errorMessage</font></h3>";  // Generate the login <form> layout
      ?>
        <table>
          <tr><td>Enter your user-name:</td>
              <td><input type="text" size=10 
                       maxlength=10 
                       name="formUsername"></td></tr>     
          <tr><td>Enter your password:</td>
              <td><input type="password" size=10 
                       maxlength=10
                       name="formPassword"></td></tr>
        </table>
        <p><input type="submit" value="Log in">
        </form>
        </body>
      </html>
      <?
    }//
    // Function that returns HTML page showing that 
    // the user with the $currentLoginName is logged on
    //
    function logged_on_page($currentLoginName)
    {  // Generate the page that shows the user 
      // is already authenticated and authorized
      ?>
      <html>
      <head>
         <title>Welcome</title>
      </head>
      <body>
        <h2>Welcome!</h2>
        <h2>You are currently logged in as 
            <?=$currentLoginName ?></h2>
        <a href="logout.php">Logout</a>
      </body>
      </html>
      <?
    }// Main
    session_start();// Check if we have established a session
    if (isset($HTTP_SESSION_VARS["authenticatedUser"]))
    {
      // There is a user logged on
      logged_on_page(
              $HTTP_SESSION_VARS["authenticatedUser"]);
    }
    else
    {
      // No session established, no POST variables 
      // display the login form + any error message
      login_page($HTTP_SESSION_VARS["loginMessage"]);  session_destroy();
    }
    ?>  
      

  4.   

    <?php
    session_start();
    if(!isset($HTTP_SESSION_VARS['jueban'])){
    header("Location: loginout.php");
    }
    ?>