<!--#INCLUDE FILE="../../inc/Conn.asp"-->
<%Const ItemPath="../../"%>
<!--#INCLUDE FIlE="../../inc/Main_Function.asp"-->
<!--#INCLUDE FILE="../inc/Main_Function.asp"-->
<%
Dim Action,ModuleName,CheckErr,MsgStr

ModuleName=D("Config")

CheckAdminLogin 3
Action=LCase(Request("Action"))

CheckErr = False

Select Case Action
Case "do_mod":header("CreateDragContainer(document.getElementById('cityList'));checkhexie();"):Call Do_Mod_Config()
Case "testspeed":Call testspeed()
Case Else:	  header("CreateDragContainer(document.getElementById('cityList'));checkhexie();"):Call Mod_Config()
End Select

If CheckErr Then
	Response.Write("<script>alert('"&MsgStr&"');history.back();</script>")
	Response.End()
ElseIf MsgStr<>"" Then
	Response.Redirect(MsgStr)
End If
footer
destroy

Sub Mod_Config()
	Dim Rs,baseconfig,hotel,installpath,weburl,cachename,installpath2
	Set Rs = DB.Execute("SELECT * FROM ZN_"&ModuleName)
	If Not Rs.Eof then
		baseconfig = Split(Rs("Config_BaseConfig")&"-_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_-","-_-")
		hotel = Split(Rs("Config_hotel")&"-_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_--_-","-_-")
		
		installpath = Left(LCase(Request.ServerVariables("SCRIPT_NAME")), InStrRev(LCase(Request.ServerVariables("SCRIPT_NAME")), "/") - 1)
		installpath = Left(installpath, InStrRev(installpath, "/")-1)
		installpath = Left(installpath, InStrRev(installpath, "/"))
		installpath2=installpath
		If installpath=LCase(Rs("Config_InstallPath")) Then installpath=Rs("Config_InstallPath")

		weburl = "http://"& LCase(Request.ServerVariables("HTTP_HOST"))
		If weburl = Trim(LCase(Rs("Config_weburl"))) Then weburl = Trim(LCase(Rs("Config_weburl")))
		cachename=Rs("Config_cachename")
	Else
		CheckErr = True:MsgStr=MsgStr+"վļʧ°װĿ¼ϵ˹Ա"
	End If
	Rs.Close:Set Rs=Nothing
	If CheckErr Then Exit Sub
%>
<div id="main">
  <div class="main_box">
    <h2>޸վ</h2>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="t_list">
     <form name="modform" method="post" action="?action=do_mod" onsubmit="return fillcitylist();">
      <tr>
        <td class="td_right">վװĿ¼</td>
        <td class="td_left"><input name="installpath" type="text" id="installpath" value="<%=Server.HTMLEncode(installpath2)%>" size="40" />
        <input name="installpath2" type="hidden" value="<%=Server.HTMLEncode(installpath)%>" size="40" />
ƵƵĿ¼ ѳվ/hotel/Ŀ¼ webpath=&quot;/hotel/&quot; </td>
      </tr>
       <tr>
        <td class="td_right">վ</td>
        <td class="td_left"><input name="weburl" type="text" id="weburl" value="<%=Server.HTMLEncode(weburl)%>" size="40" />
         </td>
      </tr>
      <tr>
        <td class="td_right">վƣ</td>
        <td class="td_left"><input name="baseconfig(0)" type="text" id="baseconfig(0)" value="<%=Server.HTMLEncode(baseconfig(0))%>" size="40" />
          վ 磺ճ̾ƵԤ 벻Ҫʹ&ldquo;ס&rdquo;վƣ鵽ID˺</td>
      </tr>
      <tr>
        <td class="td_right">վȨϢ</td>
        <td class="td_left">
		<textarea name="baseconfig(2)" cols="50" rows="5" id="baseconfig(2)"><%=Server.HTMLEncode(baseconfig(2))%></textarea>
		֧html</td>
      </tr>
      <tr>
        <td class="td_right">վ״̬</td>
        <td class="td_left">
        <input type="radio" name="baseconfig(3)" value="0"<%If FU.CheckNumeric(baseconfig(3)) = 0 Then Response.Write (" checked=""checked""")%>/>
          
  <input type="radio" name="baseconfig(3)" value="1"<%If FU.CheckNumeric(baseconfig(3)) = 1 Then Response.Write (" checked=""checked""")%>/>
          ر
  </td>
      </tr>
      <tr>
        <td class="td_right">վ״̬˵</td>
        <td class="td_left"><textarea name="baseconfig(4)" cols="50" rows="5" id="baseconfig(4)"><%=Server.HTMLEncode(baseconfig(4))%></textarea></td>
      </tr>
      <tr>
        <td class="td_right">Ƿ֣</td>
        <td class="td_left"><textarea name="baseconfig(5)" cols="50" rows="5" id="baseconfig(5)"><%dim a,TextContent
		For a = 1 To len(baseconfig(5))
			TextContent=TextContent&Mid(baseconfig(5),a,1)&"{з}"
		Next
		response.Write(TextContent)
		%></textarea><br />ǷҪѶݵķǷӷǷʧܵʱԳڴ{з}{з}ΪָûʵôҪΪ˷ֹθô</td>
      </tr>
      <tr>
        <td class="td_right">&nbsp;</td>
        <td class="td_left">&nbsp;</td>
      </tr>
      <tr>
        <td class="td_right">ƹID</td>
        <td class="td_left"><input name="hotel(0)" type="text" id="hotel(0)" value="<%=hotel(0)%>" size="40" /></td>
      </tr>
      <tr>
        <td class="td_right">˼ַ</td>
        <td class="td_left"><input name="hotel(1)" type="text" id="hotel(1)" value="<%=Server.HTMLEncode(hotel(1))%>" size="40" /></td>
      </tr>
       <tr>
        <td class="td_right">˶KEY</td>
        <td class="td_left"><input name="hotel(16)" type="text" id="hotel(16)" value="<%=Server.HTMLEncode(hotel(16))%>" size="40" /></td>
      </tr>
      <tr>
        <td class="td_right">Ĭϳ</td>
        <td class="td_left"><input name="hotel(2)" type="text" id="hotel(2)" value="<%=Server.HTMLEncode(hotel(2))%>" size="40" /><input name="hotel(3)" type="hidden" id="hotel(3)" value="<%=hotel(3)%>" size="40" /></td>
      </tr>
       <tr>
        <td class="td_right">ҳѡ</td>
        <td class="td_left">
<%=CreatcityList%><input type="hidden" value="<%=hotel(4)%>" name="hotel(4)" id="hotel(4)" />
<div id="cityList">
<%If hotel(4)<>"" Then
dim citylist,cityitem,i
citylist=split(hotel(4),",")
	If ubound(citylist)>0 Then
		for i=0 to ubound(citylist)
		cityitem=split(citylist(i),"|")
			response.Write("<span ondblclick=""return updatename(this,'"&trim(cityitem(1))&"')"" style=""border:#CCC solid 1px;padding:3px;cursor:move;"" value="""&trim(cityitem(1))&""" id="""&trim(cityitem(0))&""">"&trim(cityitem(1))&"<em style=""cursor:pointer"" onclick=""return delCity("&trim(cityitem(0))&");""></em></span>")
		next
	Else
		cityitem=split(citylist(0),"|")
		response.Write("<span ondblclick=""return updatename(this,'"&trim(cityitem(1))&"')"" style=""border:#CCC solid 1px;padding:3px;cursor:move;"" value="""&trim(cityitem(1))&""" id="""&trim(cityitem(0))&""">"&trim(cityitem(1))&"<em style=""cursor:pointer"" onclick=""return delCity("&trim(cityitem(0))&");""></em></span>")
	End If
End If
%>

</div>
         </td>
      </tr>
      <tr>
        <td class="td_right">ǷӲļ棺</td>
        <td class="td_left">
        <span class="tablerow">
          <input type="radio" name="hotel(13)" value="0"<%If FU.CheckNumeric(hotel(13)) = 0 Then Response.Write (" checked=""checked""")%>/>
          ر
          <input type="radio" name="hotel(13)" value="1"<%If FU.CheckNumeric(hotel(13)) = 1 Then Response.Write (" checked=""checked""")%>/>
           </span>ǿҽ򿪻棬Լվٶȡռ䲻½ռҲҪ򿪴˹ܣ</td>
      </tr>
      <tr>
        <td class="td_right">ǷApplication棺</td>
        <td class="td_left">
        <span class="tablerow">
          <input type="radio" name="hotel(15)" value="0"<%If FU.CheckNumeric(hotel(15)) = 0 Then Response.Write (" checked=""checked""")%>/>
          ر
          <input type="radio" name="hotel(15)" value="1"<%If FU.CheckNumeric(hotel(15)) = 1 Then Response.Write (" checked=""checked""")%>/>
           </span>ҳؼԶҪ˹֧֣ǿҽ򿪻棬վٶ.</td>
      </tr>
       <tr>
        <td class="td_right">ʱ</td>
        <td class="td_left"><input name="hotel(6)" type="text" id="hotel(6)" value="<%=hotel(6)%>" size="40" /> 
        ΪλֵԽվٶԽ죡</td>
      </tr>
       <tr>
        <td class="td_right"></td>
        <td class="td_left"><input name="cachename" type="text" id="cachename" value="<%=Server.HTMLEncode(cachename)%>" size="40" /></td>
      </tr>
       <tr style="display:none;" >
        <td class="td_right">ӿڵַ</td>
        <td class="td_left">
        <%=getHost(Server.HTMLEncode(hotel(9)))%>&nbsp;&nbsp;<input type="button" name="testspeed" id="testspeed" value="" onclick="return dotestspeed(this);" class="btn03" />&nbsp;&nbsp;ķͨ·Ƽͨͨؾ⣻ķΪ·ƼõţеŸؾ
        </td>
      </tr>
       <tr style="display:none;" >
        <td class="td_right">Ƶѯα̬ҳǰ</td>
        <td class="td_left"><input name="hotel(10)" type="text" id="hotel(10)" value="<%=hotel(10)%>" size="40" /> 
        磺search-c80-x0---a0-e1.html searchǰ</td>
      </tr>
          <tr style="display:none;">
        <td class="td_right">Ƶϸα̬ҳǰ</td>
        <td class="td_left"><input name="hotel(11)" type="text" id="hotel(11)" value="<%=hotel(11)%>" size="40" /> 
        磺hotel-53-4881.html hotelǰ</td>
      </tr>
        <tr>
        <td class="td_right">ǷʾϴͼƬ</td>
        <td class="td_left">
        <span class="tablerow">
          <input type="radio" name="hotel(12)" value="0"<%If FU.CheckNumeric(hotel(12)) = 0 Then Response.Write (" checked=""checked""")%>/>
          ʾ
          <input type="radio" name="hotel(12)" value="1"<%If FU.CheckNumeric(hotel(12)) = 1 Then Response.Write (" checked=""checked""")%>/>
          ʾ </span></td>
      </tr>
      
        <tr style="display:none;">
        <td class="td_right">Զ£</td>
        <td class="td_left"><span class="tablerow">
          <input type="radio" name="hotel(14)" value="0"<%If FU.CheckNumeric(hotel(14)) = 0 Then Response.Write (" checked=""checked""")%>/>
          ر
          <input type="radio" name="hotel(14)" value="1"<%If FU.CheckNumeric(hotel(14)) = 1 Then Response.Write (" checked=""checked""")%>/>
           򿪴˹ܵ¼̨ʱԶվ</span></td>
          
      </tr>
      
      <tr>
        <td class="td_right">α̬</td>
        <td class="td_left"><span class="tablerow2">
          <textarea name="hotel(8)" cols="100" rows="5"><%=Server.HTMLEncode(hotel(8))%></textarea>
         </span></td>
      </tr>
      
      
      <tr>
        <td class="td_right">α̬</td>
        <td class="td_left"><span class="tablerow">
          <input type="radio" name="hotel(7)" value="0"<%If FU.CheckNumeric(hotel(7)) = 0 Then Response.Write (" checked=""checked""")%>/>
          ر
          <input type="radio" name="hotel(7)" value="1"<%If FU.CheckNumeric(hotel(7)) = 1 Then Response.Write (" checked=""checked""")%>/>
           վл˹ʱҪ<a href="../Cache/Zhuna_Cache.asp" target="main">վ</a>α̬ͬʱ̬ĬʱΪһһ¡</span>
          </td>
      </tr>
       <tr>
        <td class="td_right">ʹģ棺</td>
        <td class="td_left"><span class="tablerow">
        <%dim mobanname,ar_moban
		mobanname = GetFolders(ItemPath&"template")
		ar_moban = split(mobanname,"|")
		for i = 1 to ubound(ar_moban)
			response.Write "<input type='radio' name='hotel(17)' value='"&ar_moban(i)&"' "
			if hotel(17) = ar_moban(i) Then
			response.Write " checked=""checked"" />" 
			else
			Response.Write  "/>"
			end if
			response.Write ar_moban(i)&"ģ "
			'" & "<a href='editlist.asp?moban="&ar_moban(i)&"' >༭ģ</a>
		next
		 %>
        
         </span>
          
          
          </td>
      </tr>
      <tr>
        <td class="td_right">&nbsp;</td>
        <td class="td_left">
        <input name="submit" type="submit" class="btn05" onMouseOver="this.className='btn06'" onMouseOut="this.className='btn05'" id="submit" value="ύ" />
        <input type="button" name="backbutton" id="backbutton" class="btn05"  onclick="history.back(1);" value="" /></td>
      </tr>
    </form>
    </table>
  </div>
</div>
<SCRIPT src="../../javascript/drag_drop.js" type=text/javascript></SCRIPT>
<SCRIPT src="../../javascript/cookie.js" type=text/javascript></SCRIPT>
<script>
function checkhexie()
{
	var str=document.getElementById("baseconfig(5)").value;
	document.getElementById("baseconfig(5)").value=str.replace(/{з}/g,"");
}
function dotestspeed(val){
if(GetCookie("testspeed"))
{
	val.disabled=true;
	val.parentNode.innerHTML+=GetCookie("testspeed").split('||||')[0];
	eval(GetCookie("testspeed").split('||||')[1]);
}
else
{
	val.disabled=true;
	val.value="..";
	xmlHttp('Zhuna_Config.asp?action=testspeed&r='+Math.random(),
		function(e){	
			var es=e.split('||||');
		    val.parentNode.innerHTML+=es[0];
			eval(es[1]);
			_g('testspeed').value="";
			SetCookie("testspeed",e,60*60*24);//һ
	});
}}
function _g(n){return document.getElementById(n)}
function xmlHttp(Url,xmlBack){var xObj=null;try{xObj=new ActiveXObject("MSXML2.XMLHTTP")}catch(e){try{xObj=new ActiveXObject("Microsoft.XMLHTTP")}catch(e2){try{xObj=new XMLHttpRequest()}catch(e){}}};with(xObj){open("get",Url, true);onreadystatechange=function(){if(readyState==4&&status==200){xmlBack(responseText)}};send(null)}};

var dragHelper = document.createElement('DIV');
dragHelper.style.cssText = 'position:absolute;display:none;';
document.getElementById("cityList").appendChild(dragHelper);
function changtag(val)
{
	CreateDragContainer(document.getElementById('cityList'));
	var root=document.getElementById("cityList")
	var oNote=root.getElementsByTagName("span");
	var isthere=false;
	for(i=0;i<oNote.length;i++){
	if(oNote[i].attributes.getNamedItem("id"))
	var id=oNote[i].attributes.getNamedItem("id").nodeValue;
	if(oNote[i].attributes.getNamedItem("value"))
	var value=oNote[i].attributes.getNamedItem("value").nodeValue;
	if((id+"|"+value)==val)isthere=true;
	}
	if(!isthere){
	var val=val.split('|');
		document.getElementById("cityList").innerHTML+="<span ondblclick=\"return updatename(this,'"+val[1]+"');\" style=\"border:#CCC solid 1px; padding:3px;cursor:move;\" value=\""+val[1]+"\" id=\""+val[0]+"\">"+val[1]+"<em style=\"cursor:pointer\" onclick=\"return delCity("+val[0]+");\"></em></span>";
	}
	
}
function updatename(val,itemval)
{
	if(val.innerHTML.indexOf("input")==-1)
	val.innerHTML=val.innerHTML.replace(itemval,"<input onblur='return changvals(this);' style='' size=4 value="+itemval+">");
}
function changvals(val)
{
	val.parentNode.setAttribute("value",val.value);
}
function fillcitylist()
{
	var root=document.getElementById("cityList")
	var oNote=root.getElementsByTagName("span");
	var liststr="";
	for(i=0;i<oNote.length;i++){
		if(oNote[i].parentNode.style.display!="none"){
		if(oNote[i].attributes.getNamedItem("id")){
			var id=oNote[i].attributes.getNamedItem("id").nodeValue;
			liststr+=id+"|";
		}
		if(oNote[i].attributes.getNamedItem("value")){
			var value=oNote[i].attributes.getNamedItem("value").nodeValue;
			liststr+=value+",";
		}
		}
	}
	if(liststr.length>0){
	document.getElementById("hotel(4)").value=liststr.substr(0,liststr.length-1);}
	else{
	alert("ҳѡΪգ");
	return false;}
}
function delCity(val)
{
	document.getElementById(val).parentNode.removeChild(document.getElementById(val));
}
</script>
<%
End Sub

Sub Do_Mod_Config()
	Dim BaseConfig,hotel,i,Rs,SQL,cityid,AP
	If Request("installpath")="" Then CheckErr=True:MsgStr=MsgStr+"վĿ¼Ϊա"
	If Request("hotel(0)")="" Then CheckErr=True:MsgStr=MsgStr+"ƹIDΪա"
	If Request("hotel(1)")="" Then CheckErr=True:MsgStr=MsgStr+"˼ַΪա"
	If Request("cachename")="" Then CheckErr=True:MsgStr=MsgStr+"Ϊա"
	If Request("hotel(9)")="" Then CheckErr=True:MsgStr=MsgStr+"ӿڵַΪ"
	
	For i = 0 To 5
		If i=5 Then
			BaseConfig = BaseConfig & replace(Trim(Request.Form("baseconfig(" & i & ")")),"{з}","") & "-_-"
		Else
			BaseConfig = BaseConfig & Trim(Request.Form("baseconfig(" & i & ")")) & "-_-"
		End If
	Next
	For i = 0 To 17
		If i=3 Then
			cityid=getcityid(Trim(Request.Form("hotel(2)")))
			If cityid<>0 Then
			hotel = hotel & Trim(cityid) & "-_-"
			Else
				CheckErr=True
				MsgStr="ҲĳID"
			End If
		Else
			hotel = hotel & Trim(Request.Form("hotel("&i&")")) & "-_-"
		End If
	Next
	
	If Not CheckErr Then
		SQL = "SELECT * FROM ZN_"&ModuleName
		Set Rs = DB.Recordset(SQL,1,3)
		If Not Rs.Eof Then
			If split(Rs("Config_hotel"),"-_-")(0)<>Trim(Request.Form("hotel(0)")) or split(Rs("Config_hotel"),"-_-")(1)<>Trim(Request.Form("hotel(1)")) Then
				If checkcityid(Trim(Request.Form("hotel(0)")),Trim(Request.Form("hotel(1)")))=1 Then
					response.Write("<script>alert(""ID߼ַȷ飡"");history.back(1);</script>")
					response.End()
				End If
			End If
			If split(Rs("Config_hotel"),"-_-")(7)<>Trim(Request.Form("hotel(7)")) Then
				If Trim(Request.Form("hotel(7)"))=1 Then
					If IsFile("/httpd.ini") Then
						response.Write("<script>alert(""վĿ¼´httpd.iniļվҪļͨftpļٽдα̬ܵĲ"");history.back(1);</script>")
						response.End()
					Else
						Call CreatFile("/httpd.ini",Trim(Request.Form("hotel(8)")))
					End If
				Else
					Call Deletefiles("/httpd.ini")
				End If
			End If
			Dim files,tstr,fso,tempstr,f
			If (Rs("Config_installpath")<>FU.CheckBadstr(Trim(Request.Form("installpath")))) or (FU.CheckBadstr(Trim(Request.Form("installpath2")))<>FU.CheckBadstr(Trim(Request.Form("installpath")))) Then
				set fso=server.CreateObject("Scripting.FileSystemObject")
					If fso.FileExists(server.mappath("../../inc/SETUP.ASP")) Then
						set files=fso.OpenTextFile(server.mappath("../../inc/SETUP.ASP"))
						do while files.AtEndOfStream = false
							tempstr=files.ReadLine
							if instr(tempstr,"""DBPath""")>0 Then
								tstr=tstr&"D.Add ""DBPath"","""&FU.CheckBadstr(Trim(Request.Form("installpath2")))&""""&vbcrlf
							else
								tstr=tstr&tempstr&vbcrlf
							end if
						loop
						set f=fso.CreateTextFile(server.mappath("../../inc/SETUP.ASP"),true)
						f.write(tstr)
						f.close:set f=nothing
						Set files=Nothing
					end if
				Set fso=Nothing
			End If
			'û
			If Rs("Config_cachename")<>FU.CheckBadstr(Trim(Request.Form("cachename"))) Then
				set fso=server.CreateObject("Scripting.FileSystemObject")
					If fso.FileExists(server.mappath("../../inc/SETUP.ASP")) Then
						set files=fso.OpenTextFile(server.mappath("../../inc/SETUP.ASP"))
						do while files.AtEndOfStream = false
							tempstr=files.ReadLine
							if instr(tempstr,"""Cachename""")>0 Then
								tstr=tstr&"D.Add ""Cachename"","""&FU.CheckBadstr(Trim(Request.Form("cachename")))&""""&vbcrlf
							else
								tstr=tstr&tempstr&vbcrlf
							end if
						loop
						set f=fso.CreateTextFile(server.mappath("../../inc/SETUP.ASP"),true)
						f.write(tstr)
						f.close:set f=nothing
						Set files=Nothing
					end if
				Set fso=Nothing
			End If
			
			Rs("Config_installpath")=FU.CheckBadstr(Trim(Request.Form("installpath")))
			Rs("Config_weburl")=FU.CheckBadstr(Trim(Request.Form("weburl")))
			Rs("Config_BaseConfig")=BaseConfig
			Rs("Config_hotel")=hotel
			Rs("Config_cachename")=FU.CheckBadstr(Trim(Request.Form("cachename")))
			Rs.update
			'д뻺
				Set AP=new ApplicationClass
				AP.Add Rs("Config_cachename")&"installpath",FU.CheckBadstr(Trim(Request.Form("installpath"))),365
				AP.Add Rs("Config_cachename")&"weburl",FU.CheckBadstr(Trim(Request.Form("weburl"))),365
				AP.Add Rs("Config_cachename")&"BaseConfig",BaseConfig,365
				AP.Add Rs("Config_cachename")&"hotel",hotel,365
				AP.Add "cachename",FU.CheckBadstr(Trim(Request.Form("cachename"))),365
				Set AP=Nothing
	dim objXMLx
    set objXMLx=createobject("MSXML2.SERVERXMLHTTP.3.0")  'XMLHTTPԿռǷ֧XMLHTTP
    objXMLx.open "GET","http://union.api.zhuna.cn/index.php?m=count.setup&v=asp_v1&var=1.0&uid="&request("hotel(0)")&"&mk="&request("hotel(1)")&"&host="&request("weburl")&"&title="&Request("baseconfig(0)")&"",false 'falseʾͬķʽȡҳ룬˽ʲôͬʲô첽
    objXMLx.send() '
    set objXMLx=nothing'ر
			MsgStr="../Msg.asp?title="&ec("޸ĳɹ,ֶɾdatabase/"&request("hotel(17)")&"/ļ")&"&msg="&ec("ز")&"<br><a href="""&request.ServerVariables("SCRIPT_NAME")&"?Action=mod"">"&ec("޸")&"</a>"
		End If
		Rs.Close:Set Rs=Nothing
	End If
End Sub

Function getcityid(cityname)
	dim apiUrl,http,backXml,xml,root,iscreat,creathlisturl,objNodes
	apiUrl=doserver&"city.asp?u="&agent_id&"&m="&agent_md&"&cityname="&ec(cityname)&""
	apiUrl=apiUrl&"&domain="&domain&"&Copyright="&Copyright&"&doname="&server.URLEncode(doname)&""
	creathlisturl=webpath&"DataBase/XML/city/"&replace(webpath,"/","")&"_getCity_all.xml"

	set xml=GetXml(apiUrl,creathlisturl)
	if xml.xml<>"" then
		set root=xml.documentElement
		Set objNodes = root.selectSingleNode("city[@name='"&cityname&"']")
		if objNodes is nothing then
		getcityid=1
		else
		getcityid =objNodes.getAttribute("ID")
		end if
	else
		getcityid=1
	end if
	set xml=nothing
End Function
Function CreatcityList()
	dim apiUrl,xml,root,creathlisturl,objNodes,strs,i
	apiUrl=doserver&"city.asp?u="&agent_id&"&m="&agent_md
	apiUrl=apiUrl&"&domain="&domain&"&Copyright="&Copyright&"&doname="&server.URLEncode(doname)&""
	creathlisturl=webpath&"DataBase/XML/city/"&replace(webpath,"/","")&"_getCity_all.xml"
	set xml=GetXml(apiUrl,creathlisturl)
	if xml.xml<>"" then
		set root=xml.documentElement
		Set objNodes = root.childNodes
		If objNodes.Length>0 Then
			strs="<select onchange=""return changtag(this.value);"">"&vbCrlf
			For i=0 to objNodes.Length-1
			'  <city ID="97" name="麣" HotelNum="71" suoxie="ZH" /> 
				strs=strs&"<option value='"&objNodes.item(i).getAttribute("ID")&"|"&objNodes.item(i).getAttribute("name")&"'>"&objNodes.item(i).getAttribute("suoxie")&chr(13)&objNodes.item(i).getAttribute("name")&"</option>"&vbCrlf
			Next
			strs=strs&"</select>"
		End If
		CreatcityList=strs
	else
		CreatcityList=""
	end if
	set xml=nothing
End Function

'֤ǷΪ˻Ա
Function checkcityid(agent_id,agent_md)
	dim apiUrl,xml,root
	apiUrl="http://un.zhuna.cn/api/gbk/usercheck.asp?u="&agent_id&"&m="&agent_md
	set xml=GetXml(apiUrl,"")
	if xml.xml<>"" then
		set root=xml.documentElement
		if root is nothing then
			checkcityid=1
		else
			checkcityid =root.text
		end if
	else
		checkcityid=1
	end if
	set xml=nothing
End Function

Function getHost(val)
	dim xml,root,objNodes,strs,selected,i
	set xml=GetXml("http://un.zhuna.cn/api/dns.xml","")
	if xml.xml<>"" then
		set root=xml.documentElement
		Set objNodes = root.childNodes
		If objNodes.Length>0 Then
			strs="<select name=""hotel(9)"" id=""hotel(9)"">"&vbCrlf
			For i=0 to objNodes.Length-1
				selected=""
				if cstr(val)=cstr(objNodes.item(i).getAttribute("v")&"/api/gbk/") then
			 	selected=("selected")
			 	end if
				strs=strs&"<option value='"&objNodes.item(i).getAttribute("v")&"/api/gbk/' "&selected&">"&objNodes.item(i).getAttribute("title")&"</option>"&vbCrlf
			Next
			strs=strs&"</select>"
		End If
	end if
	set xml=nothing
	getHost=strs
End Function

Function testspeed()
if request.Cookies("testspeed")<>"" Then
response.Write(FU.CheckBadstr(request.Cookies("testspeed")))
response.End()
End If
response.Write("<br>")
	dim xml,root,objNodes,selected,i,apiUrl,startime,endtime,xml2,citynode,lesstime,star,j,colors
	set xml=GetXml("http://un.zhuna.cn/api/dns.xml","")
	set xml2=GetXml("http://un.zhuna.cn/api/gbk/city.asp","")
	if xml.xml<>"" then
		set root=xml.documentElement
		Set objNodes = root.childNodes
		Set citynode=xml2.documentElement.childNodes
		If objNodes.Length>0 Then
			For i=0 to objNodes.Length-1
				colors="green"
				For j=0 to 3
					apiUrl=objNodes.item(i).getAttribute("v")&"/api/gbk/cityname.asp?u="&agent_id&"&m="&agent_md&"&cityid="&citynode.item(i+j).getAttribute("ID")
					startime= Timer()
					If ExXML(GetBackXml(apiUrl),"").xml<>"" Then
						Endtime=Endtime+(Timer()-startime)
					End If					
				Next
				Endtime=round(Endtime/4,6)
				If Endtime<>"" Then
					If Endtime>0.1 Then colors="red"
					response.Write(objNodes.item(i).getAttribute("title")&"ַȡ&nbsp;&nbsp;ʱ䣺<font color="&colors&">"&Endtime&"</font><br>")
					If lesstime="" Then lesstime=Endtime:star=objNodes.item(i).getAttribute("v")
					If lesstime>Endtime Then lesstime=Endtime:star=objNodes.item(i).getAttribute("v")
				End If
			Next
		End If
	end if
	set xml=nothing
response.Write("<br>ϢӳǴķȡƵϢʱ䡣Խο<font color=brown>[˹ܱڷ˲,ڱزٶȷӳǴĵԻȡϢٶ]</font>")
response.Write("||||var city_sel=document.getElementById(""hotel(9)"");for(var i=0;i<city_sel.options.length;i++){if(city_sel.options[i].value=='"&star&"/api/gbk/'){city_sel.options[i].selected=true;break;}}")
End Function

function GetFolders( currentFolder )
	Dim sServerDir
	sServerDir = Server.MapPath(currentFolder)

	Dim oFSO, oCurrentFolder, oFolders, oFolder
	Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )
	if not (oFSO.FolderExists( sServerDir ) ) then
		Set oFSO = Nothing
		exit function
	end if

	Set oCurrentFolder = oFSO.GetFolder(sServerDir)
	Set oFolders = oCurrentFolder.SubFolders
	For Each oFolder in oFolders
		GetFolders = GetFolders
			GetFolders = GetFolders&"|"&oFolder.name
		'Call GetFiles(currentFolder,)
	Next
	Set oCurrentFolder=Nothing
	Set oFolders = Nothing
	Set oFSO = Nothing
End function

%>