<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("CDNAUID")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf not IsNumeric(session("CDNAUID"))  Then
	ef=True
	ec="osid应该是数字！"
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
If IsNull(dsph("hostname")) then
	ef=True
	ec="绑定域名后才能下载日志！"
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

 txml=dateadd("y",-1,now)


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

<br>
<form action="CDNop2.asp" method="post" name="modhostname" id="modhostname">
  <TABLE width="100%" border=1 align=center cellPadding=0 cellSpacing=0 borderColorLight=#cccccc borderColorDark=#fbfbfb>
    <TBODY>
      <TR align="center">
        <TD height="35" vAlign=middle bgColor=#494949>&nbsp; <font color="#FFFFFF">
          <input name="id" type="hidden" value="<%=Request("id")%>">
        流量分析：</font></TD>
      </TR>
      <TR>
            <%
If dsph("CDNMaxMb")=0 Then
endp=0
else
endp=dsph("CDNMBthismonth")*100/dsph("CDNMaxMb")
End if
if endp>99 then endp=100
%>
        <TD height="50" align="center" vAlign=bottom bgColor=#FFFFFF>昨天的流量为 <%=dsph("CDNMB"&day(txml))%> MB　　(您的月流量上限为
            <%if dsph("CDNMaxMb")=0 then%>
            不限流量
            <%else%>
            <%=dsph("CDNMaxMb")%>MB 已用了<%=FormatNumber(endp,1,-1)%>%
            <%end if%>
            )<br>

<table width="520"  border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
  <tr>
    <td height="20">
	<table width="<%=endp%>%" height="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FF0000">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
	</td>
  </tr>
</table>


</TD>
      </TR>
      <TR>
        <TD height="200" align="center" vAlign=middle bgColor=#FFFFFF>
		
		
		


<table width="520" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="right" valign="top" id="endMaxid" style="line-height: 12px; margin-right: 2;text-align: right;padding:0px"> </td>
            <td><table width="500" border="1" cellpadding="0" cellspacing="0" background="img/deepback.gif">
              <tr>
                <td><table width="18"  border="0" cellspacing="1" cellpadding="1">
                    <tr>
                      <%
nowtime=Date
runcountMax=0
'runcountMaxAGN=0
Y=1
For i=-29 To -1
runtime=dateadd("d",i,nowtime)
runtime2=dateadd("d",i+1,nowtime)

runcount=dsph("CDNMB"&day(dateadd("y",i,now)))

If runcount>runcountMax Then runcountMax=runcount

%>
                      <td width="14" height="100" valign="bottom" title="<%=runcount%>" id="TDid<%=Y%>"><table width="14"  border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td valign="bottom" bgcolor="#006600"  id="TDidX<%=Y%>" title="<%=Year(runtime)%>-<%=Month(runtime)%>-<%=Day(runtime)%> <%If Weekday(runtime)=7 then%>(星期六)<%End If%><%If Weekday(runtime)=1 then%>(星期日)<%End If%>
流量: <%=runcount%> MB"><table width="14" height="0" border="0" cellpadding="0" cellspacing="0">

</table>
</td>
                          </tr>
                      </table></td>
                      <%
Y=Y+1
next%>
                    </tr>
                    <tr>
                      <%
'nowtime=date
For i=-29 To -1
runtime=dateadd("d",i,nowtime)
runtime2=dateadd("d",i+1,nowtime)
%>
                      <td width="14" title="<%=Year(runtime)%>-<%=Month(runtime)%>-<%=Day(runtime)%>"><a href="#">
                        <%If Weekday(runtime)=1 or Weekday(runtime)=7 then%>
                        <font color=red><%=Day(runtime)%></font>
                        <%else%>
                        <%=Day(runtime)%>
                        <%End if%>
                      </a></td>
                      <%next%>
                    </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table>
<div style="width:520px;margin:12px 0px 12px 18px;color:#999">单位为MB，上图为近期的每天流量表</div>


<%if runcountMax=0 then runcountMax=0.001%>
<script>
document.getElementById("endMaxid").innerHTML="<%=FormatNumber(runcountMax,0,-1)%><br><br><%=FormatNumber(runcountMax*3/4,0,-1)%><br><br><%=FormatNumber(runcountMax*2/4,0,-1)%><br><br><%=FormatNumber(runcountMax*1/4,0,-1)%>";
<%For Y=1 To 29%>
document.getElementById("TDidX<%=Y%>").style.height = document.getElementById("TDid<%=Y%>").title*100/<%=runcountMax%>;
<%next%>
</script>

		
		
		
		
		</TD>
      </TR>
    </TBODY>
  </TABLE>
<input name="id" type="hidden" value="<%=Request("id")%>">
</form>

<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%>
