<!--#include file=byshop_conn.asp-->
<!--#include file="../md5.asp"-->

<%
dim user,pass,comeurl
user=replace(trim(request("user")),"'","")
pass=md5(replace(trim(request("pass")),"'",""))
if user="" or pass="" then
response.write "<script LANGUAGE='javascript'>alert('对不起！您的登录名或密码有误！');history.go(-1);</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 [byshop_user] where ( reglx=1 or reglx=0) and user='"&user&"' and pass='"&pass&"' " ,conn,1,3
if not(rs.bof and rs.eof) then
if pass=rs("pass") then
response.Cookies("byshop")("user")=rs("user")
response.Cookies("byshop")("reglx")=rs("reglx")
rs("lastlogin")=now()
rs("logins")=rs("logins")+1
rs("ip")=rs("lastip")'上次的ip
rs("lastip")=Request.ServerVariables("REMOTE_ADDR")'这次ip
rs.Update
rs.Close
set rs=nothing
response.redirect "index.asp"
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
%> 
 