<!--#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>w163采集系统 - 管理登陆</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 ("w163_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" ><div align="center">
      <table width="320" border="0" align="right" cellpadding="0" cellspacing="0">
	  <form action="w163_login.asp?action=chk" method="post" name="login">
        <tr>
          <td width="134" rowspan="2">　</td>
          <td width="140" height="100">　</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>　</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>
<table id="table1" borderColor="#c0c0c0" width="90%" border="0">
	<tr>
		<td height="33">
		<p align="center"><b>网站建设</b><p align="center"><b>&nbsp;<a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin=229705396&Site=w163采集系统&Menu=yes"><img alt="" src="http://wpa.qq.com/pa?p=1:229705396:6" border="0" pop="点击这里给我发消息"></a>
		</b>
		<p align="center"><b>&nbsp;<a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin=85651782&Site=w163采集系统&Menu=yes"><img alt="点击这里给我发消息" src="http://wpa.qq.com/pa?p=1:85651782:6" border="0"></a></b></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("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	elseif session("getcode")="" then
		ErrMsg="<li> 请不要重复提交，如需重新登录请返回登录页面。"
		response.Redirect("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	elseif cstr(session("getcode"))<>cstr(trim(code)) then
		ErrMsg="<li> 您输入的确认码和系统产生的不一致，请重新输入。"
		response.Redirect("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	end if
		session("getcode")=""
	if username="" or password="" then
		ErrMsg="<li> 请输入您的用户名或密码。"
		response.Redirect("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
		Exit Sub
	end if
		
	dim rs	
	password = md5 (password)
	set rs = ConnItem.Execute("select top 1 * from admin where Username='"&username&"'")
	if rs.eof and rs.bof then 
		ErrMsg="<li> 您输入的用户名不正确或者您不是系统管理员。请<a href=w163_login.asp>重新输入</a>您的用户名。"
		response.Redirect("w163_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=w163_login.asp>重新输入</a>您的密码。"
			response.Redirect("w163_err.asp?action=AdminErr&ErrMsg="&ErrMsg&"")
			exit sub
		end if
	end if
	rs.close
end sub
%>