Call 这种页面怎么看啊
session  看一看php 浪子星空的帮助文件吧!

解决方案 »

  1.   

    一般进行用户验证的session比较简单,你从form表单提交时用session_register()函数注册用户名和密码,判断用户名和密码是否为有效用户名和密码,然后在各需要提供用户名和密码才能浏览的页面上用session_start(),判断用户名和密码是否存在,如果存在的话,就显示该页面,如不存在,就让他重新登陆或是返回。上面的将session的各部分功能都写成了函数,你只需代入相应的参数就可以了!<?
      session_start();
      session_register("user_name");
      session_register("use_pass");
      session_register("group_id");
      $group_id = 0;
      require("comman.php");
      $DB = new MyOraDB;
      if (($username)and($password)){
          $Sql = "select * from user_info where user_name='$username' and password ='$password'";
           $DB -> query($Sql);
           while($DB ->next_record()){
                              }
           }else{
                print "<script language=javascript>";
                print "alert('对不起!该用户名或密码有误请重新输入');window.location='login.php';";
                print "</script>";
      }  } else{
    ?>
    <html>
    <head>
    <title>无标题文档</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script LANGUAGE=javascript>
            function aa(){
                if (document.login.username.value==""){
                    alert('请输入用户名!');
                    return false;
                }
                if (document.login.password.value==""){
                    alert('请输入密码!');
                    return false;
                }
            }
    </script>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <table width="550" border="0" cellpadding="0" cellspacing="0" align="center">
      <tr>
      <form name=login method=post action="login.php">
        <td width="550" height="396" valign="middle">
          <table width="257" border="0" align="center">
            <tr>
                <td align="center" valign="top" bgcolor="#FFCC99"> 用户名:
                  <input type="text" name="username">
                  <br>
                  密 码:&nbsp;
                  <input type="password" name="password">
              </td>
            </tr>
            <tr>
                <td valign="middle" align="center" bgcolor="#FFCC99">
                  <input type="submit" name="Submit" value="确 认" ONCLICK="aa()">
                  <input type="reset" name="Submit2" value="取 消">
                </td>
            </tr>
          </table>
        </td>
       </form>
      </tr>
    </table>
    </body>
    </html>
    <?}?>