<!-- #include file="conn.asp" --> <!--包含数据库连接文件--> <% session.Timeout=15 if request.Form("SUSER01")<>"" and request.Form("SUSER02")<>"" then session("UserName")=request.Form("SUSER01") session("PWD")=request.Form("SUSER02") set rs=server.createobject("ADODB.recordset") rs.open "select * from S_USER where SUSER01='"&request.Form("SUSER01")&"'",conn,1,1 if rs.eof then %> <script language="javascript"> alert("您输入的管理员名称错误,请重新输入!"); </script> <% else session("SUSER03")=rs("SUSER03") if rs("SUSER02")=session("PWD") then %> <script language="javascript"> window.location.href="index.asp" </script> <%else%> <script language="javascript"> alert("您输入的管理员密码错误,请重新输入!"); history.back(); </script> <%end if end if end if %>
<script language="javascript"> function mycheck(){ if (form1.SUSER01.value=="") {alert("请输入操作员姓名!");form1.UserName.focus();return;} if(form1.SUSER02.value=="") {alert("请输入密码!");form1.PWD.focus();return;} form1.submit(); } </script>
<form name="form1" method="post" action="login1.asp"> <table width="250" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="25" colspan="2" align="center">登陆页面</td> </tr> <tr> <td width="76" height="25">用户名:</td> <td width="174" height="25"> <select name="SUSER01" id="SUSER01" value="SUSER01" onKeyPress="EnterE(document.form1.SUSER02)"> <option>==请选择==</option> <% set rs = server.CreateObject("ADODB.recordset") rs.open "select * from S_USER",conn,1,3 %> <% do while not rs.eof %> <option value="SUSER01"><%=rs("SUSER01")%></option> <% rs.movenext loop %> </select> </td> </tr> <tr> <td height="25">密 码:</td> <td height="25"> <input name="SUSER02" type="password" id="SUSER02" size="15" onKeyPress="EnterE(document.form1.Button)" > </td> </tr> <tr> <td height="25" colspan="2" align="center"> <input type="Button" name="Button" value="提交" onClick="mycheck()"> <input type="reset" name="Submit2" value="重置"> </td> </tr> </table> </form> 这是一个登陆页面~~ 用户名 使用调用数据库的用户名{ 字段“SUSER01” } <select > <option ><%=rs("SUSER01")%></option> </select > 但是当我输入正确的用户名和密码的时候 总是显示“您输入的管理员名称错误,请重新输入” SUSER01 用户名 SUSER02 密码 SUSER03 用户权限 表名:S_USER 高手帮我找下错误啊`~ 我实在找不到那错了~!