<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
	Response.Expires = 0 
	Response.AddHeader "Pragma","no-cache"
	Response.AddHeader "cache-ctrol","no-cache"

If session("CDNAUID")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf not IsNumeric(session("CDNAUID"))  Then
	ef=True
	ec="id应该是数字！"
elseif Request.Form ("url")="" or Request.Form ("url")="http://" or RegExpTest("[^.A-Za-z0-9_]",Replace(Replace(Replace(Replace(Trim(Request.Form ("url")),"http://",""),"/",""),":",""),"-","")) Then
	ef=True
	ec="url没填或非法！"
end if

if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_CDN where id='"&session("CDNAUID")&"'"
	dsph.Open Sql,conn,1,3
if dsph.Eof then
	ef=True
	ec="不存在的数据库产品ID！"
end if
end if

if not ef then
	Set dsCDNpdlist = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_CDNProductlist where CDNtype='"&dsph("CDNtype")&"'"
	if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	dsCDNpdlist.Open Sql,conn,1,1
if dsCDNpdlist.Eof then
	ef=True
	ec="产品不存在！"
end If
end If


if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerBindlist where id='"&dsph ("Bindserverid1")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="DNS服务器1不存在！"
end if
end If

if not ef then
	Set dsserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerBindlist where id='"&dsph ("Bindserverid2")&"'"
	dsserver.Open Sql,conn,1,1
if dsserver.Eof then
	ef=True
	ec="DNS服务器2不存在！"
end if
end If

if not ef then
	Set dsCDNserver = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_ServerCDNlist where cdntype='多点分布CDN加速用'  and (Bindserverid1='"&dsph ("Bindserverid1")&"' or Bindserverid1='"&dsph ("Bindserverid2")&"' or Bindserverid2='"&dsph ("Bindserverid1")&"' or Bindserverid2='"&dsph ("Bindserverid2")&"')"
	dsCDNserver.Open Sql,conn,1,1
if dsCDNserver.Eof then
	ef=True
	ec="CDN服务器不存在！"
end if
end if


if not ef then
%>
<!--#include virtual="/inc-freehost-function/template-CDNadm-top.asp"-->
　
<p>CDN自助管理


  <br>
  <br>
  <br>
CDN操作
 
<br>
<br>
<br>
<%

while not dsCDNserver.Eof
URL=dsCDNserver("site")
FreeHostsharekey=dsCDNserver("FreeHostsharekey")

'If Request.Form ("Submit")="马上更新缓存" Then
pushurl=Trim(Request.Form ("url"))
op=0
CDNcon=" -p 80 -m PURGE "+pushurl
retstr="  尝试发送命令："&CDNOP(URL,FreeHostsharekey,CDNcon,cachemgr,mime,squid,squid_radius_auth,hosts,op)
response.write retstr&" 如果提示命令失败很可能是URL不存在，或并没有缓存。"'&CDNcon
'end if

dsCDNserver.movenext
wend
%>
<br>
<br>
  <br>
  <br>
  <br>
  　<a href="selfCDNmodify.asp?id=<%=Request("id")%>"><font color="#000000">[返回]</font></a>
  <!--#include virtual="/inc-freehost-function/template-CDNadm-end.asp"-->
  <%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>