<%
'**************************************
'* 最后更新 2009-7-13 by 56770.kingdge 
'* Copyright www.56770.com             
'**************************************
ShowPath = "<a href='"& Eshop_url & LangPath &"'>"& Lebi_word(0) &"</a> → <a href='"& PagePath(0) &"'>"& Lebi_word(8) &"</a> → "& Lebi_user(160) &""
Select Case request("action")
	   Case "xgpass" : xgpass()
	   Case "xgzl" : xgzl()
	   Case "lostpass" : lostpass()
	   Case "getpass" : myuser_main = getpass()
End Select 

Sub xgpass()
        Dim user_password
        ps1=safereplace(request("ps1"))
		ps=safereplace(request("ps"))
        if ps="" or Len(ps)>16 or len(ps)<6 Then
		        error_type = error_type & ",1,"
				Is_error = 1
		elseif ps1="" or Len(ps1)>16 or len(ps1)<6 Then
				error_type = error_type & ",2,"
				Is_error = 1
        elseif ps<>ps1 Then
				error_type = error_type & ",3,"
				Is_error = 1
        End If 
		If Is_error = 1 Then 
		        response.redirect PagePath(1) &"?action=modiuserinfo&error_type="& error_type
				response.End 
		Else 
				'-----------------------------------------------------------------
				'系统整合
				'-----------------------------------------------------------------
				Dim API_LEBI,API_SaveCookie,SysKey
				If API_Enable Then
					Set API_LEBI = New API_Conformity
					API_LEBI.NodeValue "action","update",0,False
					API_LEBI.NodeValue "username",safereplace(request.cookies(cookiesname)("user_id")),1,False
					Md5OLD = 1
					SysKey = Md5(API_LEBI.XmlNode("username") & API_ConformKey)
					Md5OLD = 0
					API_LEBI.NodeValue "syskey",SysKey,0,False
					API_LEBI.NodeValue "password",ps,1,False
					API_LEBI.SendHttpData
					If API_LEBI.Status = "1" Then
						Response.Write "<script>alert('" &  API_LEBI.Message  & "');</script>"
						Exit Sub
					End If
					Set API_LEBI = Nothing
				End If
				'-----------------------------------------------------------------
                user_password=md5(ps)
                conn.execute "update [Lebi_user] set user_password='"&user_password&"' where user_id='"& safereplace(request.cookies(cookiesname)("user_id")) &"'"
                response.redirect PagePath(0) &"?action=modi&xgpass=ok"
                response.end
        end If
End sub

Dim fapiao_taitou,fapiao_company,fapiao_zhanghao,fapiao_shuihao,fapiao_adds,fapiao_zip
Dim regerror
Sub xgzl()
        user_postalcode=safereplace(request("user_postalcode"))
        user_tel=safereplace(request("user_tel"))
        user_name=safereplace(request("user_name"))
        user_mail=safereplace(request("user_mail"))
        oicq=safereplace(request("oicq"))
        if oicq="" then oicq=" "
        fax=safereplace(request("fax"))
        if fax="" then fax=" "
        city=safereplace(request("city"))
        user_adds=safereplace(request("user_adds"))
        fapiao_taitou=safereplace(request("fapiao_taitou"))
        fapiao_company=safereplace(request("fapiao_company"))
        fapiao_zhanghao=safereplace(request("fapiao_zhanghao"))
        fapiao_shuihao=safereplace(request("fapiao_shuihao"))
        fapiao_adds=safereplace(request("fapiao_adds"))
        fapiao_zip=safereplace(request("fapiao_zip"))
		If Len(user_name)<2 Or Len(user_name)>=20 Then
		        error_type = error_type & ",4,"
				Is_error = 1
        End if
		If Len(user_tel)<6 Or Len(user_tel)>20 Then
		        error_type = error_type & ",5,"
				Is_error = 1
        End if
		If IsValidEmail(user_mail)=false Then
		        error_type = error_type & ",6,"
				Is_error = 1
		End if
		If user_postalcode="" Or Len(user_postalcode)>6 Or not IsNumeric(user_postalcode) Then
		        error_type = error_type & ",7,"
				Is_error = 1
		End if
        If user_adds="" Or Len(user_adds)<5 Or Len(user_adds)>100 Then
		        error_type = error_type & ",8,"
				Is_error = 1
	    End If
		If Is_error = 1 Then 
		        response.redirect PagePath(1) &"?action=modiuserinfo&error_type="& error_type
				response.End 
		Else 
				user_answer = safereplace(trim(request("user_answer")))
				user_question = safereplace(trim(request("user_question")))
				'-----------------------------------------------------------------
				'系统整合
				'-----------------------------------------------------------------
				Dim API_LEBI,API_SaveCookie,SysKey
				If API_Enable Then
					Set API_LEBI = New API_Conformity
					API_LEBI.NodeValue "action","update",0,False
					API_LEBI.NodeValue "username",safereplace(request.cookies(cookiesname)("user_id")),1,False
					Md5OLD = 1
					SysKey = Md5(API_LEBI.XmlNode("username") & API_ConformKey)
					Md5OLD = 0
					API_LEBI.NodeValue "syskey",SysKey,0,False
					API_LEBI.NodeValue "user_name",user_name,1,False
					API_LEBI.NodeValue "question",user_question,1,False
					API_LEBI.NodeValue "answer",user_answer,1,False
					API_LEBI.NodeValue "email",user_mail,1,False
					API_LEBI.NodeValue "mobile",user_tel,1,False
					API_LEBI.NodeValue "qq",oicq,1,False
					API_LEBI.NodeValue "address",user_adds,1,False
					API_LEBI.NodeValue "zipcode",user_postalcode,1,False
					API_LEBI.NodeValue "telephone",fax,1,False
					API_LEBI.SendHttpData
					If API_LEBI.Status = "1" Then
						Response.Write "<script>alert('" &  API_LEBI.Message  & "');</script>"
						Exit Sub
					End If
					Set API_LEBI = Nothing
				End If
				'-----------------------------------------------------------------
				If user_answer <>"" Then conn.execute "update [Lebi_user] set user_answer='"& md5(user_answer) &"' where user_id='"& safereplace(request.cookies(cookiesname)("user_id")) &"'"
                conn.execute "update [Lebi_user] set user_name='"&user_name&"',fax='"&fax&"',oicq='"&oicq&"', city='"&city&"', user_postalcode='"&user_postalcode&"', user_tel='"&user_tel&"', user_mail='"&user_mail&"', user_adds='"&user_adds&"',fapiao_company='"&fapiao_company&"',fapiao_adds='"&fapiao_adds&"',fapiao_zip='"&fapiao_zip&"',user_question='"& user_question &"' where user_id='"& safereplace(request.cookies(cookiesname)("user_id")) &"'"
        		response.redirect PagePath(0) &"?action=modi&xgzl=ok"
        		response.End
        End if
End Sub

Sub lostpass()
        Dim user_password
        ps1=safereplace(request("newpass"))
		ps=safereplace(request("Re_newpass"))
        u = safereplace(Trim(request("u")))
		r = safereplace(Trim(request("r")))
		Set rs = conn.execute("select * from [Lebi_lostpass] where l_user_id = '"& u &"' and l_md5str = '"& r &"'")
		If rs.eof Then 
		        response.redirect"../"
		        response.End 
		End If 
		rs.close : Set rs = Nothing 
        if ps="" or Len(ps)>16 or len(ps)<6 Then
		        error_type = error_type & ",1,"
				Is_error = 1
		elseif ps1="" or Len(ps1)>16 or len(ps1)<6 Then
				error_type = error_type & ",2,"
				Is_error = 1
        elseif ps<>ps1 Then
				error_type = error_type & ",3,"
				Is_error = 1
        End If 
		If Is_error = 1 Then 
		        response.redirect PagePath(1) &"?action=modiuserinfo&error_type="& error_type
				response.End 
		Else 
				'-----------------------------------------------------------------
				'系统整合
				'-----------------------------------------------------------------
				Dim API_LEBI,API_SaveCookie,SysKey
				If API_Enable Then
					Set API_LEBI = New API_Conformity
					API_LEBI.NodeValue "action","update",0,False
					API_LEBI.NodeValue "username",u,1,False
					Md5OLD = 1
					SysKey = Md5(API_LEBI.XmlNode("username") & API_ConformKey)
					Md5OLD = 0
					API_LEBI.NodeValue "syskey",SysKey,0,False
					API_LEBI.NodeValue "password",ps,1,False
					API_LEBI.SendHttpData
					If API_LEBI.Status = "1" Then
						Response.Write "<script>alert('" &  API_LEBI.Message  & "');</script>"
						Exit Sub
					End If
					Set API_LEBI = Nothing
				End If
				'-----------------------------------------------------------------
                user_password=md5(ps)
                conn.execute("update [Lebi_user] set user_password='"&user_password&"' where user_id='"& u &"'")
                response.redirect PagePath(0) &"?action=changepass&do=update&u="&u&"&r="&r&"&newpass="& ps1
                response.end
        end If
End Sub

Function getpass()
        Dim user_name,answer,newpass,Re_newpass
        user_name = safereplace(trim(request("user_name")))
        answer = safereplace(trim(request("answer")))
        newpass = safereplace(trim(request("newpass")))
        Re_newpass = safereplace(trim(request("Re_newpass")))
		If Len(newpass) < 6 Or Len(newpass) > 16 Then 
                getpass = "<table width='100%' cellpadding='0' cellspacing='1' align='center' class='MyUserInfo'>"
				getpass = getpass & "<tr><td class='headmenu' height='25'>"& Lebi_word(3) &"&nbsp;&nbsp;〖"& Lebi_user(160) &"〗</td></tr>"
				getpass = getpass & "<tr><td height='25' class='list'>·"& Lebi_user(162) &"</td></tr>"
				getpass = getpass & "<tr><td height='30' class='list'>·<a href='javascript:history.go(-1)'><font color=red><span id=""backtime"">0</span></font> "&Lebi_user(75)&"</a></td></tr>"
				getpass = getpass & "<script language=""JavaScript"">Url=""javascript:history.go(-1)"";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown(3);</script>"
				getpass = getpass & "<tr><td height='25' class='list' align='right'><a href='javascript:history.go(-1)'><img border=0 src="&Eshop_url&"images/re.gif align=absmiddle> "& Lebi_word(4) &"</a></td></tr>"
				getpass = getpass & "</table>"
		End If 
        If newpass <> Re_newpass Then 
                getpass = "<table width='100%' cellpadding='0' cellspacing='1' align='center' class='MyUserInfo'>"
				getpass = getpass & "<tr><td class='headmenu' height='25'>"& Lebi_word(3) &"&nbsp;&nbsp;〖"& Lebi_user(160) &"〗</td></tr>"
				getpass = getpass & "<tr><td height='25' class='list'>·"& Lebi_user(58) &"</td></tr>"
				getpass = getpass & "<tr><td height='30' class='list'>·<a href='javascript:history.go(-1)'><font color=red><span id=""backtime"">0</span></font> "&Lebi_user(75)&"</a></td></tr>"
				getpass = getpass & "<script language=""JavaScript"">Url=""javascript:history.go(-1)"";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown(3);</script>"
				getpass = getpass & "<tr><td height='25' class='list' align='right'><a href='javascript:history.go(-1)'><img border=0 src="&Eshop_url&"images/re.gif align=absmiddle> "& Lebi_word(4) &"</a></td></tr>"
				getpass = getpass & "</table>"
	    End If       
	    set Rs = conn.execute("select user_answer from [Lebi_user] where user_id = '"& user_name &"'")
	    If not rs.eof Then 
                If cstr(trim(rs("user_answer"))) = cstr(md5(answer)) Then
			            conn.execute("Update [Lebi_user] set user_password='"& md5(trim(newpass)) &"' where user_id='"& user_name &"'")
                        getpass = "<table width='100%' cellpadding='0' cellspacing='1' align='center' class='MyUserInfo'>"
						getpass = getpass & "<tr><td class='headmenu' height='25'>"& Lebi_user(160) &"</td></tr>"
					    getpass = getpass & "<tr><td height='25' class='list'>·"& Lebi_user(175) &" "& newpass &"</td></tr>"
						getpass = getpass & "<tr><td height='30' class='list'>·<a href='javascript:history.go(-1)'><font color=red><span id=""backtime"">0</span></font> "&Lebi_user(75)&"</a></td></tr>"
						getpass = getpass & "<script language=""JavaScript"">Url="""& PagePath(6) &""";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown(10);</script>"
						getpass = getpass & "</table>"
                Else         
						'response.write trim(rs("user_answer")) &"|"& cstr(md5(answer))
                		getpass = "<table width='100%' cellpadding='0' cellspacing='1' align='center' class='MyUserInfo'>"
						getpass = getpass & "<tr><td class='headmenu' height='25'>"& Lebi_word(3) &"&nbsp;&nbsp;〖"& Lebi_user(160) &"〗</td></tr>"
						getpass = getpass & "<tr><td height='25' class='list'>·"& Lebi_user(176) &"</td></tr>"
						getpass = getpass & "<tr><td height='30' class='list'>·<a href='javascript:history.go(-1)'><font color=red><span id=""backtime"">0</span></font> "&Lebi_user(75)&"</a></td></tr>"
						getpass = getpass & "<script language=""JavaScript"">Url=""javascript:history.go(-1)"";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown(3);</script>"
						getpass = getpass & "<tr><td height='25' class='list' align='right'><a href='javascript:history.go(-1)'><img border=0 src="&Eshop_url&"images/re.gif align=absmiddle> "& Lebi_word(4) &"</a></td></tr>"
						getpass = getpass & "</table>"
                End If 
		Else          
                getpass = "<table width='100%' cellpadding='0' cellspacing='1' align='center' class='MyUserInfo'>"
				getpass = getpass & "<tr><td class='headmenu' height='25'>"& Lebi_word(3) &"&nbsp;&nbsp;〖"& Lebi_user(160) &"〗</td></tr>"
				getpass = getpass & "<tr><td height='25' class='list'>·"& Lebi_user(173) &"</td></tr>"
				getpass = getpass & "<tr><td height='30' class='list'>·<a href='javascript:history.go(-1)'><font color=red><span id=""backtime"">0</span></font> "&Lebi_user(75)&"</a></td></tr>"
				getpass = getpass & "<script language=""JavaScript"">Url=""javascript:history.go(-1)"";if (!Url){Url=document.referrer}function countDown(secs){document.getElementById(""backtime"").innerHTML=secs;if(--secs>0) {setTimeout(""countDown(""+secs+"")"",1000);}else {window.location.href=Url;}}countDown(3);</script>"
				getpass = getpass & "<tr><td height='25' class='list' align='right'><a href='javascript:history.go(-1)'><img border=0 src="&Eshop_url&"images/re.gif align=absmiddle> "& Lebi_word(4) &"</a></td></tr>"
				getpass = getpass & "</table>"
		End If 
End Function 
%>