www.gusucode.com > 深度学习(asp)通讯录 0.0.10 (utf-8)码程序 > admin/deep_login.asp

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'session.CodePage=65001
response.Charset=utf-8

projectRootPath = "../"	'相对当前应用程序根的位置
%>
<!-- #include file="../connDB.asp"-->
<!-- #include file="include/md5.asp"-->

<html>
<head>
    <meta name="robots" content="noindex,nofollow" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="noindex,nofollow" />
    <title>系统后台登陆界面</title>
    <link rel="stylesheet" type="text/css" href="themes/base.css" />
	<link href="themes/frmRight/frameRight.css" rel="stylesheet" type="text/css" />
    
	<script type="text/javascript">
    function check()
    {
      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>

</head>

<body id="bodyBg1">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
  <tr>
    <td >
    
      <table width="300" border="0" align="center" cellspacing="0">
    <tr>
      <td> 
      <!--登陆错误信息提示-->
<%
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 tAdmin 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 cellpadding=2 cellspacing=1 border=0 width=400  align=center>" & vbcrlf
		strErr=strErr & "  <tr align='center'><td height='22' ><strong>错误信息</strong></td></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()
	
%>
      
      <!--重新登陆信息提示-->
      <div align="center"></div>
      </td>
    </tr>
	</table>
<form id="formLogin" name="admininfo" method="post" action="" onSubmit="return check()">
  <table  id="tableLogin">
    <tr>
      <td colspan="2"  class="bg_bar"></td>
    </tr>
    <tr>
      <td colspan="2" class="titlebg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;管理员登录 </td>
    </tr>
    <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>&nbsp;</td>
      <td>
      <img src="include/getCode.asp" width="80" height="20" onClick="this.src='include/getCode.asp?rand='+Math.random();" title="看不清?单击此处刷新" style="cursor:pointer;"/></td>
    </tr>    
    <tr>
      <td>&nbsp;</td>
      <td><div align="center">
  		<input type="submit" name="Submit" value="登 录"  /> &nbsp;
        <input type="reset" name="Reset" value="清 除" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><div align="right"><a href="javascript:window.external.addFavorite(document.URL,'系统后台登陆');">加入收藏夹</a> &nbsp; &nbsp;</div></td>
    </tr>
    <tr>
      <td colspan="2"  class="bg_bar"></td>
    </tr>
  </table>
</form>
<div align="center" class="fWhite">
  <br>
  <p>程序开发:<a href="http://www.DeepTeach.com" target="_blank" class="cWhite">吕海鹏</a><br />
<a href="http://www.DeepTeach.com" target="_blank" class="cWhite">DeepTeach.com</a></p>
</div>
    
    </td>
  </tr>
</table>
</body>
</html>