<!--#include file="conn1.asp"-->

<%username=replace(trim(request("username")),"'","")
password=replace(trim(request("password")),"'","")
verifycode=replace(trim(request("verifycode")),"'","")%>


<%
if request("username")="" then
	response.write "<script LANGUAGE='javascript'>alert('用户名不能为空！');history.go(-1);</script>"
	response.end
end if

if request("password")="" then
	response.write "<script LANGUAGE='javascript'>alert('密码不能为空！');history.go(-1);</script>"
	response.end
end if

if request("verifycode")="" then
	response.write "<script LANGUAGE='javascript'>alert('请输入确认码！');history.go(-1);</script>"
	response.end
	
	
elseif session("VerifyCode")="" then
	response.write "<script LANGUAGE='javascript'>alert('请不要重复提交，如需重新登陆请返回登陆页面！');history.go(-1);</script>"
	response.end	
elseif csng(Session("VerifyCode"))<>csng(Request.Form("VerifyCode")) then
	response.write "<script LANGUAGE='javascript'>alert('您输入的确认码有误，请重新输入！');history.go(-1);</script>"
	response.end
end if%>


<%set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from member where username='"&username&"' and Password='"&password&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if password=rs("Password") then
response.cookies("thdc")("username")=username
response.cookies("thdc")("id")=rs("id")
rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs.Update
rs.Close
set rs=nothing
'response.Write""&request.cookies("thdc")("username")&""
'response.Write""&request.cookies("thdc")("id")&""
response.Redirect"member.asp"
end if
else
response.Redirect"login.asp?action=对不起，您的用户名或密码有误"
response.write "<script LANGUAGE='javascript'>alert('对不起，您的用户名或密码有误！');history.go(-1);</script>"
end if
%>
