<%dbdns="../"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../bbs/inc/md5.asp"-->
<!--#include file="../inc/dlxf_inside.asp"-->
<%call SaveSqlLog(3)
call SF_Sql
if request("user")="" then
	response.write "<script>alert('用户登录出错，下面是产生错误的可能原因：\n\n·请输入用户名');history.go(-1);</Script>"
	Response.End 
elseif Request("pass")="" then
	response.write "<script>alert('用户登录出错，下面是产生错误的可能原因：\n\n·请输入用户密码');history.go(-1);</Script>"
	Response.End 
elseif int(replace(trim(Request("regjm")),"'",""))<>int(Session("GetCode")) then
	response.write "<script>alert('用户登录出错，下面是产生错误的可能原因：\n\n·认证码输入错误');history.go(-1);</Script>"
	Response.End 
end if

    nick=replace(trim(request("user")),"'","")
    password=md5(replace(trim(Request("pass")),"'",""),32)

	set rs=server.createobject("adodb.recordset")
	sql="select * from dlxf_yp where dlxf_pass='"&password&"' and dlxf_user='"&nick&"'"
	rs.open sql,conn,1,1
 	if not(rs.bof and rs.eof) then
      if rs("dlxf_key1")=0 then
	    response.write "<script>alert('用户登录出错，下面是产生错误的可能原因：\n\n·您注册的企业已被管理员关闭,如有问题请及时和我们联系');window.open('../index.asp','_self');</Script>"
	    Response.End 
      else
	    conn.execute("update dlxf_yp set dlxf_loginhtc=dlxf_loginhtc+1 where dlxf_id="&rs("dlxf_id"))
	    conn.execute("update dlxf_yp set dlxf_lastdate="&dlxf_citytime&" where dlxf_id="&rs("dlxf_id"))
		sql="select * from sysconfig"
set rst=conn.execute(sql)
		session("useradmin")=rs("dlxf_user")
		session("pass")=rs("dlxf_pass")
		session("id")=rs("dlxf_id")
		session("vip")=rs("dlxf_vip")
		sql="select * from users where regusername='"&nick&"'"   
   set rsupass=server.createobject("adodb.recordset")
   rsupass.open sql,conn,1,3
   super_user=rst("super_user")
   if not rsupass.eof then
		Response.Cookies(super_user)("uid")=rsupass("regid")
        Response.Cookies(super_user)("uname")=nick
        Response.Cookies(super_user)("shopcn13key")=super_user
  
   
   sql="update users set userlogintimes=userlogintimes+1 where regid="&rsupass("regid")
   conn.execute(sql)
   sql="update users set lastloginIP='"&getIP()&"' where regid="&rsupass("regid")
   conn.execute(sql)
   end if
   rsupass.close
   set rsupass=nothing
		if request("ction")<>"index" then
        response.redirect(application("cityurl")&"user/admin.asp")
		else
		response.redirect "../index.asp"
		end if
	  end if
	else
	response.write "<script>alert('用户登录出错，下面是产生错误的可能原因：\n\n·用户名或密码错误,请重新输入');history.go(-1);</Script>"
	Response.End 
	end if
	
	rs.close
	conn.close
	set rs=nothing
	set conn=nothing
%>

