<!--#INCLUDE FILE="Common/Inc_DatConn.asp"-->
<!--#include file="Common/Inc_Function.asp"-->

<%
'/验证系统用户账户及管理密码/
Dim rdsMember    	'/创建会员账号访问对象/
Dim sqlMember       '/创建SQL语句/
Dim strMember   	'/会员账号/
Dim strPassWord  	'/管理密码/
Dim sqlUpdateMember
dim lailu           '/提交来路/
strMember =changechr(Request.Form("Member"))
strPassWord = changechr(Request.Form("Password"))
lailu=Request.ServerVariables("HTTP_REFERER")
yuming=request.servervariables("server_name")
if InStr(""&lailu&"",""&yuming&"")>0 then
If is_gqot_user=1 then
call ot_chklogin()
else
set rdsMember = Server.CreateObject("ADODB.Recordset")
sqlMember = "Select * From Dat_Member Where Member = '"& strMember &"'"
rdsMember.Open sqlMember,Conn
if not rdsMember.EOF then
	if strPassWord = rdsMember("PassWord") then
		if rdsMember("State") = 0 then
			Session("boobuser") = strMember
			Session("boobpass") = strPassword
			Session("intMemberKey") = rdsMember("MemberKey")
			Session("gqjb") = rdsMember("jb")
			Session("point") =rdsMember("point")		
			
			sqlUpdateMember = "Update Dat_Member Set LoginCount = LoginCount + 1 Where MemberKey = "& rdsMember("MemberKey") &""
			Conn.Execute sqlUpdateMember
			
			Response.Redirect "index.asp"
		else
			Response.Write "<script>alert(""\对不起！您的会员帐号已被禁止登录，请与管理员联系！"");window.location='Javascript:history.back()';</script>"
		end if
	else
		Response.Write "<script>alert(""\您输入的密码不正确，请重新输入！"");window.location='Javascript:history.back()';</script>"
	end if
else
	Response.Write "<script>alert(""\您输入的会员帐号不存在，请重新输入！"");window.location='Javascript:history.back()';</script>"
end if
rdsMember.Close
set rdsMember = nothing
end if
else
	Response.Write "<script>alert(""\本站拒绝远程登录！"");window.location='Javascript:history.back()';</script>"
end if
'***********************整合数据库
sub ot_chklogin()
	dim sql,rs,rsreg
	strPassWord1=md5(strPassWord,16)
	sql="select * from "&ot_usertable&" where "&ot_username&"='"&strMember& "' and "&ot_password&" ='" &strPassWord1&"'"
	set rs=ot_conn.execute(sql)
	'在整合的库中如果无记录
	if rs.bof and rs.eof then
		set rs=nothing
		Response.Write "<script>alert(""\对不起！您的会员帐号或密码不正确，请重新输入！"");window.location='Javascript:history.back()';</script>"
		exit sub
	else
	'在整合的库中如果有记录，开始判断是否已经是供求的会员
		set rsreg=server.CreateObject("adodb.recordset")
		rsreg.open "select * from Dat_Member where Member='"&strMember&"'",conn,1,3
		if rsreg.eof then
		'还不是供求的会员
			set rsrega=server.CreateObject("adodb.recordset")
			rsrega.open "select top 1 * from Dat_Member",conn,1,3
			rsrega.addnew
			rsrega("Member")=strMember
			rsrega("Password")=strPassWord
			rsrega.update
			rsrega.close
			set rsrega=nothing
			'***********添加完开始登录
	set rszh1=conn.execute("select * from Dat_Member where Member = '"& strMember &"' and PassWord='"&strPassWord&"'")
if not rszh1.eof then
Session("boobuser") = strMember
			Session("boobpass") =rszh1("Password")
			Session("intMemberKey") =rszh1("MemberKey")
			Session("gqjb") =rszh1("jb")
			Session("point") =rszh1("point")
			Session("gqlx") =rszh1("MemberType")
response.write"<script>alert(""请先完善资料"");window.open('lx.asp','_top')</script>"
Response.end
else
Response.write("<script>alert(""发生错误"");location.href=""../index.asp"";</script>")
Response.end
end if
		else
		'已经是供求的会员开始完成自动登录
		if rsreg("State") = 0 then
			Session("boobuser") = strMember
			Session("boobpass") =rsreg("Password")
			Session("intMemberKey") =rsreg("MemberKey")
			Session("point") =rsreg("point")
			Session("gqjb") =rsreg("jb")
			Session("gqlx") =rsreg("MemberType")		
			
			sqlUpdateMember = "Update Dat_Member Set LoginCount = LoginCount + 1 Where MemberKey = "&rsreg("MemberKey") &""
			Conn.Execute sqlUpdateMember
if Session("gqlx")=0 then
response.write"<script>alert(""请先完善资料"");window.open('lx.asp','_top')</script>"
Response.end
else
			Response.Redirect "index.asp"
end if
		else
			Response.Write "<script>alert(""\对不起！您的会员帐号已被禁止登录，请与管理员联系！"");window.location='Javascript:history.back()';</script>"
		end if			
		end if
		rsreg.close
		set rsreg=nothing
		set rs=nothing
	end if
end sub
%>