<!-- #include file="Setup.asp" -->
<!-- #include file="inc/MD5.asp" -->
<%
top

if Request.ServerVariables("request_method") = "POST" then

if SiteSettings("EnableAntiSpamTextGenerateForLogin")=1 then
if Request.Form("VerifyCode")<>Session("VerifyCode") then error("<li>验证码错误")
end if

ReturnUrl=LCase(Request.Form("ReturnUrl"))
UserName=HTMLEncode(Request.Form("UserName"))
Userpass=md5(Trim(Request.Form("Userpass")))



if UserName=empty then error("<li>用户名没有输入")
sql="select * from [BBSXP_Users] where UserName='"&UserName&"'"
Set Rs=Conn.Execute(SQL)
if Rs.eof then error("<li>此用户名还未注册")
if Rs("UserAccountStatus")=0 then error("<li>您的帐号尚未激活")

if Len(Rs("Userpass"))<16 then
if Request("Userpass")<>Rs("Userpass") then error("<li>您输入的密码错误")
Conn.execute("update [BBSXP_Users] set Userpass='"&Userpass&"' where UserName='"&UserName&"'")
elseif Len(Rs("Userpass"))=16 then
mdfive=16
if md5(Request("UserPass"))<>Rs("UserPass") then error("<li>您输入的密码错误")
Conn.execute("update [BBSXP_Users] set Userpass='"&Userpass&"' where UserName='"&UserName&"'")
else
if UserPass<>Rs("UserPass") then error("<li>您输入的密码错误")
end if


if Request("IsSave")=1 then
Expires=9999
else
Expires=0
end if

if Request("Eremite")="1" then
Eremite="1"
else
Eremite="0"
end if

ResponseCookies"UserID",Rs("ID"),Expires
ResponseCookies"UserPass",UserPass,Expires
ResponseCookies"Eremite",Eremite,Expires

Session("VerifyCode")=""
if ""&ReturnUrl&""<>"" and instr(ReturnUrl,"login.asp")=0 then
response.redirect ReturnUrl
else
response.write "<SCRIPT>top.location='"&SiteSettings("SiteURL")&"';</SCRIPT>"
end if


end if



select case Request("menu")
case ""
%>
<div class="mainnav">
<table cellspacing=1 cellpadding=5 border=0 width=100% class=a2>
<tr class=a3>
<td>&nbsp;<img src=images/Forum_nav.gif>&nbsp; <%ClubTree%> →  登录论坛</td>
</tr>
</table><br>
<table cellspacing=1 cellpadding=5 border=0 width=100% class=a2>
<form action="Login.asp" method="POST" name=form>
<input type="hidden" value="<%=Request.ServerVariables("HTTP_REFERER")%>" name="ReturnUrl">
<tr>
<td align="center" class=a1 colspan="2">
登录论坛
</td></tr><tr>
<td class=a3 width="40%" align="right">
用户名称：</td>
<td class=a3>
<input name="UserName" value="<%=CookieUserName%>" style="WIDTH:150">&nbsp; <a href="CreateUser.asp">没有注册?</a></td></tr> <tr>
<td class=a3 width="40%" align="right">
用户密码：</td>
<td class=a3>
<input type="password" name="Userpass" style="WIDTH:150">&nbsp;
<a href="RecoverPassword.asp">找回密码?</a></td></tr>

<%if SiteSettings("EnableAntiSpamTextGenerateForLogin")=1 then%>
<tr>
<td class=a3 width="40%" align="right">
验 证 码：</td>
<td class=a3>
<input size="20" name="VerifyCode">&nbsp;&nbsp;<img src="VerifyCode.asp" title="验证码,看不清楚?请点击刷新验证码" style=cursor:pointer onclick="this.src='VerifyCode.asp'">
</td></tr>
<%end if%>

<tr>
<td align="right" class=a3 width="40%">
登录方式：</td>
<td class=a3>
<input type="checkbox" value="1" name="IsSave" id="IsSave"><label for="IsSave">自动登录</label>

<input type="checkbox" value="1" name="eremite" id="eremite"><label for="eremite">隐身登录</label></td></tr> <tr>
<td valign="top" align="center" class=a3 colspan="2">
<input type="submit" value=" 登录 ">　<input type="reset" value=" 取消 ">
</td></tr> </form></table></div>

<br>
<center>
<a href=javascript:history.back()>BACK </a><br>
<%

case "out"
Conn.execute("Delete from [BBSXP_UsersOnline] where sessionid='"&session.sessionid&"'")
CleanCookies()
succtitle="已经成功退出"
Message=Message&"<li><a href=Default.asp>社区首页</a>"
succeed(""&Message&"<meta http-equiv=refresh content=3;url=Default.asp>")

end select



htmlend
%>