sk_login.asp

来自「1.支持文章」· ASP 代码 · 共 139 行

ASP
139
字号
<!--#include file="inc/setup.asp"-->
<!--#include file="inc/md5.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="css/admin_style.css" rel="stylesheet" type="text/css">
<title>SK采集系统 - 管理登陆</title>
<style>
body {
	background-color: #e3e3e3;
	margin-top: 100px;
}
</style>
</head>

<body>
<%
if Request("logout")="ok" then 
Session.Abandon
Response.Cookies(Site) = ""
response.write "<script>alert('您已退出管理员登陆状态');</script>"'关闭窗口
Response.Redirect ("sk_login.asp")
End if
call Admin()
   if request.QueryString("action")="" then
	if IsAdmin then
			response.Redirect("index.asp")
			response.end()
		else
			call login()
		end if
	end if
	if request.QueryString("action")="chk" then
	    call chk()   
	end if
Sub login()
%>
<table width="500" height="300" border="0" align="center" cellpadding="1" cellspacing="0">
  
  <tr valign="top">
    <td width="455" height="254" bordercolor="#FFFFFF" background="css/images/login2.jpg"><div align="center">
      <table width="320" border="0" align="right" cellpadding="0" cellspacing="0">
	  <form action="sk_login.asp?action=chk" method="post" name="login">
        <tr>
          <td width="134" rowspan="2">&nbsp;</td>
          <td width="140" height="100">&nbsp;</td>
        </tr>
        <tr>
          <td height="18"><div align="right">&nbsp;&nbsp;</div></td>
        </tr>
        <tr>
          <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><input name="username" type="text" size="20" height="18"  class="login_lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="login_lostfocus"' onblur='this.className="login_lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><input name="password" type="password" size="20" height="18" class="login_lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="login_lostfocus"' onblur='this.className="login_lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'></td>
            </tr>
            <tr>
              <td height="15"></td>
            </tr>
            <tr>
              <td><input name="code" type="text" size="4" maxlength="4"  height="18" class="login_lostfocus" gf="0" onmouseover='this.className="getfocus"' onmouseout='if (this.gf=="0") this.className="login_lostfocus"' onblur='this.className="login_lostfocus";this.gf="0"' onfocus='this.className="getfocus";this.gf="1"'>
                  <img src="inc/Code.asp" width="40" height="10"></td>
            </tr>
          </table></td>
          <td valign="bottom"><input type="image" name="登录"  src="css/images/tbdown.gif"></td>
        </tr>
        </form>
      </table>
    </div></td>
  </tr>
</table>
<% end sub
sub chk()'验证
	dim username,password,code
	username=trim(request.form("username"))
	password=trim(request.form("password"))
	code=trim(request.Form("code"))
	if code="" then
		ErrMsg="<li> 请返回输入验证码。"
		response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	elseif session("getcode")="" then
		ErrMsg="<li> 请不要重复提交,如需重新登录请返回登录页面。"
		response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	elseif cstr(session("getcode"))<>cstr(trim(code)) then
		ErrMsg="<li> 您输入的确认码和系统产生的不一致,请重新输入。"
		response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	end if
		session("getcode")=""
	if username="" or password="" then
		ErrMsg="<li> 请输入您的用户名或密码。"
		response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	end if
		
	dim rs	
	password = md5 (password)
	set rs = conn.Execute("select top 1 * from admin where Username='"&username&"'")
	if rs.eof and rs.bof then 
		ErrMsg="<li> 您输入的用户名不正确或者您不是系统管理员。请<a href=sk_login.asp>重新输入</a>您的用户名。"
		response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		exit sub
	else
		if password=rs(2) then
			response.Cookies(Site)("IsAdmin")=1
			response.Cookies(Site)("Admin_name")=username
			Select Case rs(3)
				Case "超级管理员"
					response.Cookies(Site)("Admin_type")="超级管理员"
				Case "文章管理员"
					response.Cookies(Site)("Admin_type")="文章管理员"
				Case "新闻管理员"
					response.Cookies(Site)("Admin_type")="新闻管理员"
				Case "FLASH管理员"
					response.Cookies(Site)("Admin_type")="下载管理员"
				Case "图片管理员"
					response.Cookies(Site)("Admin_type")="图片管理员"
				Case "下载管理员"
					response.Cookies(Site)("Admin_type")="下载管理员"
				Case "音乐管理员"
					response.Cookies(Site)("Admin_type")="音乐管理员"
				End Select
			response.Redirect("index.asp")
		else
			ErrMsg="<li> 您输入的密码不正确或者您不是系统管理员。请<a href=sk_login.asp>重新输入</a>您的密码。"
			response.Redirect("Sk_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
			exit sub
		end if
	end if
	rs.close
end sub
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?