<!--#include file="conn.asp"-->
<!--#include file="../md5.asp"-->
<%dim admin,password
admin=replace(trim(request("admin")),"'","")
password=md5(replace(trim(request("password")),"'",""))
	userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
	userip2 = Request.ServerVariables("REMOTE_ADDR")
if admin="" or password="" then
response.Write "<center><a href=login.asp><font color=red size=2>对不起，登陆失败，请检查您的登陆名和密码</font></a></center>"
response.end
end if
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from shop_admin where admin='"&admin&"' and password='"&password&"' " ,conn,1,1
if not(rs.bof and rs.eof) then

if password=rs("password") then
Set rs2 = Server.CreateObject("ADODB.Recordset")
             sql2="select * from shop_ip "
             rs2.open sql2,conn,1,3
             rs2.addnew
			 rs2("name")=rs("admin")
			 if userip = ""  then
		     rs2("ip")=userip2
	         else
		     rs2("ip")=userip
	         end if
			 rs2("sj")=now()
             rs2.update
             rs2.close
session("adminid")=trim(rs("adminid"))
session("admin")=trim(rs("admin"))
session("flag")=int(rs("flag"))
 if userip = ""  then
		     session("ip")=userip2
	         else
		     session("ip")=userip
	         end if
session("date")=now()
session.Timeout=20
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

%>