如何同时验证三处才能进入系统?在此先谢谢各位老师了!~~
我有个表单有三项内容要同时验证才能进入系统是什么做呢?下面代码是参考出来的,但不什么改要同时验证三处~~~谢谢了!
我是刚入门的很多代码还是不够理解,可以的话做个注释~
程序代码:
<!-- #include file="conn.asp" --> <% sql="select * from config" set rs_config=conn.execute(sql) biaoji=rs_config("biaoji") %> <% bm=trim(request.form("bm")) username=trim(request.form("username")) password=trim(request.form("password")) %> <%if username<>"" and password<>"" then%> <% '根据从表单中提取出的数据,对比数据库中的数据检验用户名和密码是否合法。 set rsadm=server.createobject("adodb.recordset") sqladm="select * from user where username='"&username&"'" rsadm.open sqladm,conn,1,1 if not rsadm.eof then if rsadm("password")="" then response.write("<script>alert('用户名不对!');history.go(-1)</script>") end if if password=rsadm("password") then session("bm")=rsadm("bm") session("username")=rsadm("username") session("password")=rsadm("password") response.redirect "reg.asp" 'response.redirect "index.asp?user="&user&"" else response.write("<script>alert('密码不对哦!');history.go(-1)</script>") end if else end if response.write("<script>alert('用户名不对!');history.go(-1)</script>") rsadm.close set rsadm=nothing conn.close set conn=nothing end if%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title><%=biaoji%>-用户登陆-</title> <style type="text/css"> td { font-size: 9pt; line-height: 12pt} a:link {color: #0080FF; text-decoration: none } a:visited {color: #0080FF; text-decoration: none } a:hover {color: #ee9c00; text-decoration: underline } </style> </head> <body bgproperties="fixed" background="images/bg01.gif"> <div align="center"> <center> <table border="0" width="800" cellpadding="0" cellspacing="0" background="images/frist.jpg" style="border-collapse: collapse" bordercolor="#111111" height="120"> <tr> <td width="100%" align="center" valign="middle"><font size="3px" color="red"><%=biaoji%><p>-用户登陆-</p></font></td> </tr> </table> </center> </div> <div align="center"> <center> <table border="0" width="800" bgcolor="#CACAFF" cellspacing="0" cellpadding="6" style="border:1px dotted #0000FF; border-collapse: collapse; color:#0000FF; background-color:#CACAFF" bordercolor="#111111"> <tr> <td width="100%"> <table border="0" width="100%" cellpadding="0" style="border-collapse: collapse; border: 1px dotted #A4A4FF" bordercolor="#111111" cellspacing="0"> <!--DWLayoutTable--> <form action="login.asp" method="post"> <tr> <td width="40%" align="right"><font color="#225ccc">部 门:</td> <td width="60%"> <font color="#0000FF"><select name="bm" style="WIDTH: 140px; color: #0066FF; border: 1px dotted #3333FF; background-color: #CACAFF">> <option>综合办</option> <option>财务部</option> </select> </font><font color="#333333"> </font> </td> </tr> <tr> <td align="right"><font color="#225ccc">用户名:</td> <td> <input name="username" type="text" id="username" style="color: #0066FF; border: 1px dotted #0000FF; background-color: #CACAFF" size="19" maxlength="100"></td> </tr> <tr> <td align="right"><font color="#225ccc">密 码:</td> <td> <input type="password" name="password" size="20" maxlength="15" style="color: #0066FF; border: 1px dotted #3333FF; background-color: #CACAFF"> </td> </tr> <tr> <td colspan="2" align="right"> <p align="center"> <input type="submit" value="提交" style="border: 1px dotted #3333FF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #CACAFF"> <input type="reset" value="重写" name="reset" style="border: 1px dotted #3333FF; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1; background-color: #CACAFF"> </td> </tr> <tr> <td colspan="2" align="right"> <p align="center"> </td> </tr> <tr> <td colspan="2" align="left"> </td> </tr> </form> </table></td> </tr> </table> </center> </div> <div align="center"> <center> <table border="0" width="800" cellpadding="0" bgcolor="#CACAFF" style="border:1px dotted #808000; border-collapse: collapse; background-color:#CACAFF" bordercolor="#111111" cellspacing="0"> <tr> <td width="100%" bgcolor="#ebebeb" height="2"></td> </tr> <tr> <td width="100%"> </td> </tr> <tr> <td width="100%"> <p align="center"><font color="#0066FF">--<%=biaoji%>--</font></td> </tr> </table> </center> </div> </body> </html>