<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%dim username,userpassword,comeurl,verifycode
username=replace(trim(request.form("shjianame")),"'","")
userpassword=md5(replace(trim(request.form("shjiapassword")),"'",""))
verifycode=replace(trim(request("verifycode")),"'","")
if username="" or userpassword="" then
response.write "<script LANGUAGE='javascript'>alert('您的管理ID或密码有误！');window.location.href='../index.asp';</script>"
response.end
end if
if cstr(session("getcode"))<>cstr(trim(request("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 [shjia] where username='"&username&"' and userpassword='"&userpassword&"' and flag=2" ,conn,1,3

if not(rs.bof and rs.eof) then
if userpassword=rs("userpassword") then
response.Cookies("godbook")("shjianame")=rs("name")
response.Cookies("godbook")("shjiaid")=rs("shjiaid")
response.Cookies("godbook")("name")=rs("name")
rs("lastlogin")=now()
rs("num")=rs("num")+1
rs("logins")=1
rs.Update
rs.Close
set rs=nothing
if request("linkaddress")="" then
response.redirect request.servervariables("http_referer")
else
response.redirect request("linkaddress")
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起，您的用户名或密码有误！你的注册资料还没有审核通过,请审核过后再登录!');history.go(-1);</script>"
end if
else
response.write "<script LANGUAGE='javascript'>alert('对不起！您的用户名或密码有误！');history.go(-1);</script>"
end if
%>