《php项目开发全程实录》第七章学校图书管理系统,管理员tsoft登录的时候提示:您输入管理员名称错误,请重新输入!
从添加管理员页面能向数据库添加管理员,
删除管理员,设置权限也可以,说明数据库设置正确。
用添加的管理员和密码和tsoft和密码登录都提示这样的错误。
请老师帮助一下,怎样能登录成功进入到首页。给老师拜年了。 

解决方案 »

  1.   

    谢谢您这么快回答我的问题。下面是代码帮我看看。
    <html>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <head>
    <title>学校图书馆管理系统</title>
    <link href="CSS/style.css" rel="stylesheet">
    <script language="javascript">
    function check(form){
    if (form.name.value==""){
    alert("请输入管理员名称!");form.name.focus();return false;
    }
    if (form.pwd.value==""){
    alert("请输入密码!");form.pwd.focus();return false;
    }
    }
    </script>
    </head>
    <body>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <form name="form1" method="post" action="chklogin.php">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="30%" bgcolor="86C1E6">&nbsp;</td>
          <td width="32%" background="Images/bg.gif"><table width="603" height="243"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#D2E3E6">
            <tr>
              <td width="50%" height="100" align="center">&nbsp;</td>
              <td width="50%">&nbsp;
              </td>
            </tr>
            <tr>
              <td height="90" rowspan="3" align="center">&nbsp;</td>
              <td height="30" valign="top">管理员名称:
                <input name="name" type="text" class="logininput" id="name3" size="25"></td>
            </tr>
            <tr>
              <td height="30" valign="top">管理员密码:
                <input name="pwd" type="password" class="logininput" id="pwd2" size="25"></td>
            </tr>
            <tr>
              <td height="30" align="center" valign="top"><input name="submit" type="submit" class="btn_grey" value="确定" onClick="return check(form1)">
    &nbsp;
    <input name="submit3" type="reset" class="btn_grey" value="重置">
    &nbsp;
    <input name="submit2" type="button" class="btn_grey" value="关闭" onClick="window.close();"></td>
            </tr>
            <tr>
              <td height="53" colspan="2" align="center"></td>
            </tr>
          </table></td>
          <td width="30%" bgcolor="86C1E6"><br></td>
        </tr>
      </table>
      <div align="center"><br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CopyRight  2007 www.mrbccd.com &nbsp;吉林***师范大学图书馆 </div>
    </form>
    </body>
    </html>
      

  2.   

    <?php
    session_start();
    $A_name=$_POST[name];          //接收表单提交的用户名
    $A_pwd=$_POST[pwd];            //接收表单提交的密码class chkinput{                //定义类
       var $name; 
       var $pwd;   function chkinput($x,$y){
         $this->name=$x;
         $this->pwd=$y;
        }   function checkinput(){
         include("conn/conn.php");      //连接数据源    
         $sql=mysql_query("select * from tb_manager where name='".$this->name."' and pwd='".$this->pwd."'",$conn);
         $info=mysql_fetch_array($sql);       //检索管理员名称和密码是否正确
         if($info==false){                    //如果管理员名称或密码不正确,则弹出相关提示信息
              echo "<script language='javascript'>alert('您输入的管理员名称错误,请重新输入!');history.back();</script>";
              exit;
           }
          else{                              //如果管理员名称或密码正确,则弹出相关提示信息
              echo "<script>alert('管理员登录成功!');window.location='index.php';</script>";
     $_SESSION[admin_name]=$info[name];
     $_SESSION[pwd]=$info[pwd];
       }
     }
    }
        $obj=new chkinput(trim($name),trim($pwd));      //创建对象
        $obj->checkinput();               //调用类
    ?>