www.gusucode.com > 深度梦想整站系统(asp) 1.14.02源码程序 > admin/deep_login.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% projectRootPath = "../" '相对当前应用程序根的位置 %> <!-- #include file="../web.config.asp"--> <!-- #include file="include/Function.Manage.Config.asp"--> <!-- #include file="../Deep_library/Deep.util.md5.asp"--> <% if request.Form("name")<>"" and request.Form("password")<>"" and request.Form("checkCode")<>"" then dim sql,rs dim username,password,CheckCode username=replace(trim(request.Form("name")),"'","") password=replace(trim(request.Form("password")),"'","") CheckCode=replace(trim(request.Form("checkCode")),"'","") if UserName="" then FoundErr=True ErrMsg=ErrMsg & "<br><li>用户名不能为空!</li>" end if if Password="" then FoundErr=True ErrMsg=ErrMsg & "<br><li>密码不能为空!</li>" end if if CheckCode="" then FoundErr=True ErrMsg=ErrMsg & "<br><li>验证码不能为空!</li>" end if if session("GetCode")="" then FoundErr=True ErrMsg=ErrMsg & "<br><li>你登录时间过长,请重新返回登录页面进行登录。</li>" end if if CheckCode<>CStr(session("GetCode")) then FoundErr=True ErrMsg=ErrMsg & "<br><li>您输入的确认码和系统产生的不一致,请重新输入。</li>" end if if FoundErr<>True then password=md5(password,32) set rs=server.createobject("adodb.recordset") sql="select * from deep_Admin where fuserName='"&username&"' and fpassword='"&password&"' " rs.open sql,conn,3,2 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>" else if password<>rs("fpassword") then FoundErr=True ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>" else 'session.Timeout=SessionTimeout session("adminName")=username response.Cookies("adminInfo")("thisLoginTime")=now() response.Cookies("adminInfo")("lastLoginTime")=rs("flastLoginTime") response.Cookies("adminInfo")("lastLoginIP")=rs("flastLoginIP") response.Cookies("adminInfo")("loginTimes")=rs("floginTimes")+1 rs("flastLoginIP")=request.ServerVariables("REMOTE_ADDR") rs("flastLoginTime")=now() rs("floginTimes")=rs("floginTimes")+1 rs.update rs.close set rs=nothing call closeConnDB() response.Redirect "manage.asp" end if end if rs.close set rs=nothing end if if FoundErr=True then strErr=strErr & "<table style='margin:0px auto; width:400px;'>" & vbcrlf strErr=strErr & " <tr align='center'><th height='22' ><strong>错误信息</strong></th></tr>" & vbcrlf strErr=strErr & " <tr><td height='100' valign='top'><b>产生错误的可能原因:</b><br />" & errmsg &"</td></tr>" & vbcrlf strErr=strErr & "</table>" & vbcrlf 'response.write strErr end if end if call closeConnDB() page_title="系统后台登陆界面" login_title="管理员登录" %> <!-- #include file="themes/DeepStudy/Login.master.asp" --> <% ' ---------------------------------------------- sub LoginForm() %> <form id="formLogin" name="admininfo" method="post" action="" onSubmit="return checkSubmit()"> <table> <tr> <td><div align="center">用户名:</div></td> <td><input type="text" name="name" /></td> </tr> <tr> <td><div align="center">密 码:</div></td> <td><input type="password" name="password" /></td> </tr> <tr> <td><div align="center">验证码:</div></td> <td><input type="text" name="checkCode" /></td> </tr> <tr> <td> </td> <td><img src="../Deep_library/Deep.util.validatorCode.asp" width="100" height="20" onClick="this.src+='?rand='+Math.random();" title="看不清?单击此处刷新" style="cursor:pointer;"/></td> </tr> <tr> <td> </td> <td><div align="center"> <input type="submit" name="Submit" value="登 录" /> <input type="reset" name="Reset" value="清 除" /> </div></td> </tr> </table> </form> <script type="text/javascript"> function checkSubmit() { if(document.admininfo.name.value=="") { document.admininfo.name.focus(); alert("管理员用户名不能为空!"); return false; } if(document.admininfo.password.value=="") { document.admininfo.password.focus(); alert("密码不能为空!"); return false; } if(document.admininfo.checkCode.value=="") { document.admininfo.checkCode.focus(); alert("验证码不能为空!"); return false; } } </script> <% end sub %>