输入用户名和密码后仍然是“无法显示”小弟刚接触asp~~确实不知道问题出在哪里,请各位大哥指点了~~(数据库名:student;字段1:user;字段2:password)
<% function checkpassword(user,passord) set conn=server.createobject("adodb.connection") param="driver={microsoft access driver (*.mdb)}" conn.open param & ";dbq=" & server.mappath("student.mdb") sql="select*from student where 用户名=’" & user & "’ and 密码=’" & password & "’" set rs=conn.execute(sql) if rs.eof then checkpassword=false else checkpassword=true end if end function %> <% if isEmpty(session("password")) then session("password")=false 用户名=request("user") 密码=request("password") if user="" or password="" then response.write"请输入您的登录名及密码。" elseif not checkstudent(user,password) then response.write"用户名或密码错误! 请检查你的用户名及密码然后再试一次!" else session("passed")=true end if if not session("passed") then%>
<body> <form runat=server method="POST"> <table width="360" border="0" align="center" cellpadding="8" bgcolor="#588FC7"> <tr> <td><h3 align="center" class="style1">登入页面</h3> <table width="260" align="center" class="9ps"> <tr> <td nowrap><div align="right" class="style2"><strong>用户名:</strong></div></td> <td colspan="2"><input name="user" type="text" id="UserName" runat=server/ size="20"> <asp:RequiredFieldValidator ControlToValidate="UserName" Display="Static" ErrorMessage="*" runat=server/> <span class="style2">*</span></td> </tr> <tr> <td nowrap><div align="right" class="style2"><strong>密码:</strong></div></td> <td colspan="2"><input name="password" type=password id="Passwords" runat=server/> <asp:RequiredFieldValidator ControlToValidate="Passwords" Display="Static" ErrorMessage="*" runat=server/> <span class="style2">*</span></td> </tr> <tr> <td colspan="3" align="center"><span class="style3"> <asp:CheckBox ID=PersistCookie runat="server" /> </span> <br> <span class="style1">(此系统仅供毕业班同学使用)</span> </td> </tr> </table> <div align="center"> <asp:Button Text="进入" OnClick="Login_Click" runat=server/> <br> <asp:Label ID="Msg" ForeColor="red" Font-Name="Verdana" Font-Size="10" runat=server /> <a href="http://127.0.0.1/web/student.mdb"> <input type=submit name=submit value="登录">
</a>
</div></td> </tr> </table> <h3 align="center"> </h3> </form> </body> |