登陆页面:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网员发布信息登录——岳阳红盾信息网</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<link href="../css/newstyle.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<br>
<br>
<br>
<br>
<div align="center">
<center>
    <table width="760" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="30" align="middle">
<div align="center"><b><font color="blue" size="3">网员发布信息登录</font></b></div></td>
      </tr>
      <tr> 
        <td height="94%" align="middle"><hr width="200" size="1" noshade color="#0000ff"></td>
      </tr>
      <tr> 
        <td height="94%" align="middle"> 
          <form action="" method="post" align = "center"
    id="form" name="company" 
            onsubmit="return ValidateInput();">
            <br>
            <div align="center">
              <table border="0" cellpadding="0" cellspacing="1" bgcolor="#6699FF">
                <tr> 
                  <td width="60" height="20"> 
                    <div align="center"><strong>用 户</strong></div></td>
                  <td width="130"> <div align="left"> 
                      <input name="username" id="username" size="15" maxLength="15">
                    </div></td>
                  <td width="60"><div align="center"><strong>密 码</strong></div></td>
                  <td width="130"> <input name="password" type="password" id="password" size="15" maxlength="15"> 
                  </td>
                  <td width="70"> <div align="center"><a href="" onclick="ValidateInput(true);return false;"><font color="#FFFF33">进 入..</font></a></div></td>
                  <td width="70"> <div align="center"> <a href="regpersonal.htm"><font color="#FFFF33">[注册]</font></a></div></td>
                  <td width="100"> 
                    <div align="center"><a href="javascript:GetMyPass()"><font color="#FFFF33">忘记密码</font> 
        </a></div></td>
                </tr>
              </table>
            </div>
<script language="JavaScript">
<!--
function ValidateInput() {
if (document.company.username.value.length>5 && document.company.password.value.length>5) 
   { document.company.action="logindemo.php";
     document.company.submit();  }
else { 
   if (document.company.username.value.length<5) { alert("请输入用户名!");}
   if (document.company.password.value.length<5) { alert("请输入密码!");}
   return false;  }
}
function GetMyPass()  {
if (document.company.username.code.value!="") {document.company.action="getpass.php";document.company.submit(); }
else  {alert("请在姓名输入框里输入用户名或注册EMAIL!");} }
//--></script></form>
</td></tr>
      <tr><td height="6%" align="middle">&nbsp; </td></tr>
    </table>
  </center></div>
</body>
</html>

解决方案 »

  1.   

    校对页面:logindemo.php
    <?php
    Session_Start();
    if( $username && $password ) {
      $username = trim( $username );
      $password = trim( $password );
      //此处加上你的连接数据库代码
      $checkid = "select * from 你的数据库表名 where username=\"".$username."\"";
      $idresu = mysql_query( $checkid, $db);
      if( mysql_error() )    {  echo "数据库检索失败!";  return;  }
      if( !mysql_num_rows($idresu) || strcmp($password,mysql_result($idresu,0,"password")) ) {
          mysql_close( $db );
          session_destroy();
          Header("Location: errormsg.php?errmsg=不正确的用户名或密码!");
          reutrn;}
      else {
          Session_Register("current_user");
          $current_user = $username;
          include("***.php");//登陆成功进入发布页面
      }
    }
    ?>