www.gusucode.com > 运动用品商城网站系统源代码程序 > stat/show_history.asp

    <!--#include file="inc_show.asp"-->
<%
public ggra

tt1d = Request("tt1d")
tt1h = Request("tt1h")
tt2d = Request("tt2d")
tt2h = Request("tt2h")

if (tt1d="" or tt1h="") and (tt2d="" or tt2h="") then
  tt1d=datevalue(dateadd("d",-1,dateadd("h",0-CFG_ZoneServer+U_TZone,now())))
  tt1h=0
  tt2d=datevalue(dateadd("h",0-CFG_ZoneServer+U_TZone,now()))
  tt2h=hour(dateadd("h",0-CFG_ZoneServer+U_TZone+1,now()))
end if

if tt1d<>"" and tt1h<> "" then
  tt1=tt1d & " " & tt1h & ":00:00"
  if (not isdate(tt1)) then Response.Redirect "help.asp?errid=7"
end if

if tt2d<>"" and tt2h<> "" then
  tt2=tt2d & " " & tt2h & ":00:00"
  if (not isdate(tt2)) then Response.Redirect "help.asp?errid=7"
end if

nnr = Request("nnr")
ggra = Request("ggra") & Request("ggraa")

if nnr="" then nnr="h"
if ggra="" then ggra="TD"

Response.Write replace(Style_Header,"$Title",Site_Name & "-" & Lang_History)
Response.Write Style_Top
Response.Write replace(Style_Tips,"$Tips",Lang_Hour_Tips)

Response.Write replace(Style_MainTop,"$MainName",Lang_His_1)
%>
<table width="420" align="center" border="0" cellpadding="0" cellspacing="0">
  <form action="show_history.asp" method="post">
  <INPUT class="INPUT" type="hidden" name="siteid" value="<%=siteid%>">
  <tr><td><%=Lang_His_2%>:</td><td>
    <INPUT class="INPUT" name="tt1d" value="<%=tt1d%>" size="9">
    <INPUT class="INPUT" name="tt1h" value="<%=tt1h%>" size="1">:00:00 <%=Lang_His_to%>
    <INPUT class="INPUT" name="tt2d" value="<%=tt2d%>" size="9">
    <INPUT class="INPUT" name="tt2h" value="<%=tt2h%>" size="1">:00:00
  </td></tr>
  <tr><td><%=Lang_His_3%>:</td><td>
    <INPUT type="checkbox" name="nnr" value="h" <%if instr(nnr,"h") then Response.Write "checked"%>> <%=Lang_His_5%>
    <INPUT type="checkbox" name="nnr" value="d" <%if instr(nnr,"d") then Response.Write "checked"%>> <%=Lang_His_6%>
  </td></tr>
  <tr><td><%=Lang_His_4%>:</td><td>
    <INPUT type="checkbox" name="ggra" value="T" <%if instr(ggra,"T") then Response.Write "checked"%>> <%=Lang_Tab%>
    <INPUT type="radio" name="ggraa" value="d" <%if instr(ggra,"d") then Response.Write "checked"%>> <%=Lang_His_7_a%>
    <INPUT type="radio" name="ggraa" value="b" <%if instr(ggra,"b") then Response.Write "checked"%>> <%=Lang_His_7_b%>
    <INPUT type="checkbox" name="ggra" value="D" <%if instr(ggra,"D") then Response.Write "checked"%>> <%=Lang_His_7_c%>
  </td></tr>
  <tr><td></td><td align="right"><a href='javascript:document.forms[0].submit();'><%=Lang_His_ok%></a> <input type="submit" name="cp" class="backc2" value=" "> &nbsp;</td></tr>
  </form>
</table>

<%
Response.Write Style_MainBottom

if Request("nnr") <> "" and Request("ggra") <> "" then

' 获取条件
	wherestr=" where "
	if tt1d<>"" and tt1h<> ""then wherestr=wherestr & "and (V_Dtime+"&U_TZone&"/24 >= #" & tt1 & "#) "
	if tt2d<>"" and tt2h<> ""then wherestr=wherestr & "and (V_Dtime+"&U_TZone&"/24 < #" & tt2 & "#) "
	wherestr=wherestr & "and site_id=" & siteid & " "
	wherestr=replace(wherestr,"where and","where")
	if trim(wherestr)="where" then wherestr=""

  
  public cw,gcw
  
  cand=true
  canh=true

  ' 创建输出对象(时)
  if instr(nnr,"h") then
    set sh=new ajgraph
    set rsh=server.createobject("adodb.recordset")
    sql="select V_View,V_IP,V_DTime+"&U_TZone&"/24 from [View] " & wherestr & " order by V_DTime"
    rsh.Open sql,conn,1,1
    lllong=rsh.RecordCount-1
    sh.reArr lllong,6
    
    i=0
    do while not rsh.EOF
      sh.ArrData(i,0)=chour(rsh(2))
      if lllong<=30 then sh.Arrdata(i,1)=hour(rsh(2))
      sh.ArrData(i,2)=rsh(1)
      sh.Arrdata(i,4)=rsh(0)
      rsh.MoveNext:i=i+1
    loop
    
    call ccw(lllong)
    if cw<=2 then canh=false
    sh.ColWidth = cw
    sh.GraColWidth = gcw
    sh.mousemodel="$0" & vbcrlf & Lang_Visitors & ": $2, $3%" & vbcrlf & Lang_PageView & ": $4, $5%"
    sh.exec
  end if

  ' 创建输出对象(日)
  if instr(nnr,"d") then
    set sd=new ajgraph
    set rsd=server.createobject("adodb.recordset")
    sql="select sum(V_View),sum(V_IP),datevalue(V_DTime+"&U_TZone&"/24) from [View] " & wherestr & " group by datevalue(V_DTime+"&U_TZone&"/24) order by datevalue(V_DTime+"&U_TZone&"/24)"
    rsd.Open sql,conn,1,1
    lllong=rsd.RecordCount-1
    sd.reArr lllong,6
    
    i=0
    do while not rsd.EOF
      sd.ArrData(i,0)=rsd(2)
      if lllong<=30 then sd.Arrdata(i,1)=day(rsd(2))
      sd.ArrData(i,2)=rsd(1)
      sd.Arrdata(i,4)=rsd(0)
      rsd.MoveNext:i=i+1
    loop
    
    call ccw(lllong)
    if cw<=3 then cand=false
    sd.ColWidth = cw
    sd.GraColWidth = gcw
    sd.mousemodel="$0" & vbcrlf & Lang_Visitors & ": $2, $3%" & vbcrlf & Lang_PageView & ": $4, $5%"
    sd.exec
  end if

  ' 输出时段图形
  if instr(nnr,"h")>0 and instr(ggra,"D")>0 then
    Response.Write replace(Style_MainTop,"$MainName",Lang_His_ok_a)
    if canh then
      Response.Write sh.Gra("D")
      Response.Write "<center><span class=""gra2"" style=""height:10;width:10;border:#000000 1px solid;""></span>&nbsp;" & Lang_Visitors & " " & sh.TotalI _
	 			& "&nbsp; <span class=""gra"" style=""height:10;width:10;border:#000000 1px solid;""></span>&nbsp;" & Lang_PageView & " " & sh.TotalV & "</center>"
	else
	  Response.Write "<center>"& Lang_His_err & "</center>"
	end if
    Response.Write Style_MainBottom
  end if

  ' 输出日段图形
  if instr(nnr,"d")>0 and instr(ggra,"D")>0 then
    Response.Write replace(Style_MainTop,"$MainName",Lang_His_ok_b)
    if cand then
      Response.Write sd.Gra("D")
      Response.Write "<center><span class=""gra2"" style=""height:10;width:10;border:#000000 1px solid;""></span>&nbsp;" & Lang_Visitors & " " & sd.TotalI _
	 			& "&nbsp; <span class=""gra"" style=""height:10;width:10;border:#000000 1px solid;""></span>&nbsp;" & Lang_PageView & " " & sd.TotalV & "</center>"
    else
      Response.Write "<center>"& Lang_His_err & "</center>"
	end if
    Response.Write Style_MainBottom
  end if
  
  ' 输出时段表格
  if instr(nnr,"h")>0 and ((instr(ggra,"d")>0) or (instr(ggra,"T")>0)) and canh then
    Response.Write replace(Style_MainTop,"$MainName",Lang_His_ok_a & "(" & Lang_Tab & ")") & "<table align=""center""><tr>"
    if instr(ggra,"T") then
      sh.TabHeader = "<tr class=""fonts"" height=""16"" align=""center""><td width=""60"">&nbsp;</td><td width=""40"">"&Lang_Visitors&"</td><td width=""35"">"&Lang_Percent&"</td><td width=""40"">"&Lang_PageView&"</td><td width=""35"">"&Lang_Percent&"</td></tr>"
      sh.TabRow = "<tr height=""16"" align=""right""><td align=""left"">&nbsp;$0</td><td>$2&nbsp;</td><td>$3%&nbsp;</td><td>$4&nbsp;</td><td>$5%&nbsp;</td></tr>"
      Response.Write "<td>" & sh.TabGra(5) & "</td>"
    end if
	if instr(ggra,"d") or instr(ggra,"b") then Response.Write "<td width=""10"">&nbsp;</td>"
    if instr(ggra,"d") then Response.Write "<td>" & sh.Gra("d") & "</td>"
    if instr(ggra,"b") then Response.Write "<td>" & sh.Gra("b") & "</td>"
    Response.Write "</tr></table>" & Style_MainBottom
  end if

  ' 输出日段表格
  if instr(nnr,"d")>0 and ((instr(ggra,"d")>0) or (instr(ggra,"T")>0)) and cand then
    Response.Write replace(Style_MainTop,"$MainName",Lang_His_ok_b & "(" & Lang_Tab & ")") & "<table align=""center""><tr>"
    if instr(ggra,"T") then
      sd.TabHeader = "<tr class=""fonts"" height=""16"" align=""center""><td width=""60"">&nbsp;</td><td width=""40"">"&Lang_Visitors&"</td><td width=""35"">"&Lang_Percent&"</td><td width=""40"">"&Lang_PageView&"</td><td width=""35"">"&Lang_Percent&"</td></tr>"
      sd.TabRow = "<tr height=""16"" align=""right""><td align=""left"">&nbsp;$0</td><td>$2&nbsp;</td><td>$3%&nbsp;</td><td>$4&nbsp;</td><td>$5%&nbsp;</td></tr>"
      Response.Write "<td>" & sd.TabGra(5) & "</td>"
    end if
	if instr(ggra,"d") or instr(ggra,"b") then Response.Write "<td width=""10"">&nbsp;</td>"
    if instr(ggra,"d") then Response.Write "<td>" & sd.Gra("d") & "</td>"
    if instr(ggra,"b") then Response.Write "<td>" & sd.Gra("b") & "</td>"
    Response.Write "</tr></table>" & Style_MainBottom
  end if
  
end if


Response.Write Style_Bottom



function chour(inhour)
  chour=datevalue(inhour) & " " & hour(inhour) & ":00-" & hour(dateadd("h",1,inhour)) & ":00"
end function

sub ccw(lllong)
  if lllong<=30 then
    cw = 13
    gcw = 10
  elseif lllong>30 and lllong<=45 then
    cw = 9
    gcw = 7
  elseif lllong>45 and lllong<=60 then
    cw = 7
    gcw = 5
  elseif lllong>60 and lllong<=80 then
    cw = 5
    gcw = 4
  elseif lllong>80 and lllong<=100 then
    cw = 4
    gcw = 3
  elseif lllong>100 and lllong<=130 then
    cw = 3
    gcw = 3
  elseif lllong>130 and lllong<=202 then
    cw=2
    gcw=2
  elseif lllong>202 and lllong<=380 then
    cw=1
    gcw=1
  else
    cw=0
    gcw=0
  end if
end sub

%>