<!--#include file="../inc/conn.asp" -->
<!--#include file="../inc/md5.asp"-->
<%
if request("act")="y" then
bbsuser=trim(request.form("bbsuser"))
password=request.form("password")
useryz=trim(request.form("useryz"))

for i=1 to len(bbsuser)
cl=mid(bbsuser,i,1)
if cl="'" or cl="<" or cl=">" or cl="%" or cl="/" or cl="-" then
   response.write "<script language='javascript'>"
   response.write "alert('密码中不能有非法字符！!');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end  
end if
next

for i=1 to len(password)
pwd=mid(password,i,1)
if pwd="'" or pwd="<" or pwd=">" or pwd="%" or pwd="/" or pwd="#" or pwd="$" or pwd="-" then
   response.write "<script language='javascript'>"
   response.write "alert('密码中不能有非法字符！!');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end 
end if
next

if cstr(session("getcode"))<>cstr(useryz) then
   response.write "<script language='javascript'>"
   response.write "alert('验证码输入有误!请核对!');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end
end if
str="select * from clubuser where clubuser_name='"&bbsuser&"' and clubuser_password='"&md5(password)&"'"
set rs=server.createobject("adodb.recordset")
rs.open str,conn,3,1
 if rs.eof then
   response.write "<script language='javascript'>"
   response.write "alert('用户名或密码错误，请重新登录！');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end
	'msg="用户名或密码错误，请重新登录！"
	'sign=0
 else
session("bbsuser")=rs("clubuser_nickname")'昵称
'session("clubuser_id")=rs("clubuser_id") '用户ID号(新增)
session("name")=rs("clubuser_name")'用户名
session("bbsadmin")=rs("bbsadmin")
session("bbs_email")=rs("clubuser_email")'邮件
session("bz")=rs("bbsmanager")
session("payuser")=rs("payuser")

'设置cookies
Response.Cookies("bbsuser")=rs("clubuser_nickname")'昵称
Response.Cookies("name")=rs("clubuser_name")'用户名
Response.Cookies("bz")=rs("bbsmanager")
Response.Cookies("bbsadmin")=rs("bbsadmin")
Response.Cookies("payuser")=rs("payuser")

Response.Cookies("bbsuser").Expires=date+Cint(Request.Form("ckies"))
Response.Cookies("name").Expires=date+Cint(Request.Form("ckies"))
Response.Cookies("bbsadmin").Expires=date+Cint(Request.Form("ckies"))
Response.Cookies("bz").Expires=date+Cint(Request.Form("ckies"))
Response.Cookies("payuser").Expires=date+Cint(Request.Form("ckies"))

if request.cookies("payuser")=3 then
   response.write "<script language='javascript'>"
   response.write "alert('对不起,你的用户名被管理员封锁了!');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end
end if
'修改用户最后登录时间、登录次数
sql="update clubuser set clubuser_lasttime='"&now()&"',tili=tili+100 where clubuser_name='"&trim(request.form("bbsuser"))&"'"
conn.execute(sql)
response.write "<script language='javascript'>"
response.write "window.location.href='"&request("reurl")&"';"
response.write "parent.left.document.location.reload();"
response.write "</script>"
response.end 
'response.redirect request("reurl")
 end if
end if
%>
<link href="../css/xmwuye.css" rel="stylesheet" type="text/css">
<script language="javascript">
<!--
	function check(form)
	{
    if (form.bbsuser.value=="")
    	{
    		alert("请填写用户名！");
    		form.bbsuser.focus();
    		return false;
  	}
    if (form.password.value=="")
    	{
    		alert("请填写密码！");
    		form.password.focus();
    		return false;
  	}
   // if (form.useryz.value=="")
   // 	{
   // 		alert("请输入验证码！");
   // 		form.useryz.focus();
  //  		return false;
  //	}
return true;
	}
//-->
</script>
<body leftmargin="8" topmargin="0">
<FORM METHOD=POST ACTION="rebbslogin.asp" onSubmit="return check(this)">
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <table width="35%" border="0" align="center" bgcolor="#333333" cellspacing="1" cellpadding="0">
    <tr bgcolor="#9999cc"> 
      <td colspan="2" height="20"> <div align="center"><font color="#FFFFFF">你还没有登录，请先登录</font></div></td>
    </tr>
    <tr bgcolor="#F8F8F8" height=25> 
      <TD> <div align="right">用户名：</div></TD>
      <TD> &nbsp; <INPUT TYPE="text" NAME="bbsuser" class="input" size="15"> </TD>
    </TR>
    <tr bgcolor="#F8F8F8" height=25> 
      <TD> <div align="right">密　码：</div></TD>
      <TD> &nbsp; <INPUT TYPE="password" NAME="password" class="input" size="15"> 
      </TD>
    </TR>
    <tr bgcolor="#F8F8F8" height=25> 
	  <TD> 
        <div align="right">Cookies：</div>
      </TD>
	<TD>&nbsp;
	<select name="ckies" id="ckies">
	  <option value="1">保存一天时间</option>
	  <option value="7">保存一周时间</option>
	  <option value="30">保存一月时间</option>
	  <option value="365">保存一年时间</option>
	  </select>
	</TD>
    </TR>
    <!--<tr bgcolor="#F8F8F8" height=25> 
      <TD height="22"> <div align="right">验证码：</div></TD>
      <TD bgcolor="#F8F8F8"> &nbsp; <INPUT NAME="useryz" TYPE="text" class="input" id="useryz" size="8"> 
      <img src=getcode.asp border=0> </TD>
    </TR>-->
    <tr bgcolor="#F8F8F8" align=center> 
      <TD height="30" colspan=2 bgcolor="#F8F8F8"> <input type="hidden" name="reurl" value="<%=request.serverVariables("HTTP_REFERER")%>"> 
        <input type="hidden" name="act" value="y"> <INPUT TYPE="submit" value="登录" name="" class="button"> 
      <A HREF="register.asp"><FONT COLOR="blue">[注册新用户]</FONT></A> </TD>
    </TR>
    <tr bgcolor="#F8F8F8" height=25> 
      <TD height="25" colspan="2"> 
        <div align="center">你刚才提交的内容已保存在剪板贴中</div></TD>
    </TR>
  </TABLE>
</FORM>
