?? tj_searchgo.asp
字號:
<%@ CODEPAGE = "936" %>
<%
'=================================
'
' 阿江酷站訪問統計系統
' Ajiang info@ajiang.net
' www.ajiang.net
'
' 版權所有·抄襲挪用必究
'
'=================================
%>
<!--#include file="inc_config.asp"-->
<%
'權限檢查
if session.Contents("master")=false and whatcan<4 then Response.Redirect "help.asp?id=004&error=您沒有使用自定義統計的權限。"
'********************************** 處理查詢條件 **********************************
'================================
'
' 從瀏覽器或者數據并處理
'
'================================
'從瀏覽器獲取數據
onyear =trim(Request("onyear"))
onmonth =trim(Request("onmonth"))
onday =trim(Request("onday"))
offyear =trim(Request("offyear"))
offmonth =trim(Request("offmonth"))
offday =trim(Request("offday"))
vip =trim(Request("vip"))
vwhere =trim(Request("vwhere"))
vos1 =trim(Request("vos1"))
vos2 =trim(Request("vos2"))
vsoft1 =trim(Request("vsoft1"))
vsoft2 =trim(Request("vsoft2"))
vcome =trim(Request("vcome"))
vpage =trim(Request("vpage"))
outtype =trim(Request("outtype"))
wherestr =trim(Request("wherestr"))
name =trim(Request("name"))
content =trim(Request("content"))
'處理獲取的數據
ontime=onyear & "-" & onmonth & "-" & onday
if (ontime <> "--") and (not isdate(ontime)) then Response.Redirect "help.asp?id=001&error=日期填寫不合乎要求。"
offtime=offyear & "-" & offmonth & "-" & offday
if (offtime <> "--") and (not isdate(offtime)) then Response.Redirect "help.asp?id=001&error=日期填寫不合乎要求。"
if (offtime <> "--") then offtime=cdate(offtime)+1 '因為SQL總是按所指日期的0時計算的,所以應該改為下一日
if (outtype ="") then Response.Redirect "help.asp?id=001&error=您沒有指明要查看的項目。"
vos=vos2
if vos = "" then vos=vos1
vsoft=vsoft2
if vsoft="" then vsoft=vsoft1
'************************************ 運算和輸出 ************************************
'================================
'
' 轉換為 SQL 指令
'
'================================
'將查詢條件轉換為SQL查詢指令
if wherestr="" then
wherestr=" where "
'如果存在查詢條件,則將查詢條件加入查詢字串
if ontime <> "--" then wherestr=wherestr & "and (vtime>=datevalue('" & ontime & "')) "
if offtime <> "--" then wherestr=wherestr & "and (vtime<=datevalue('" & offtime & "')) "
if vip <> "" then wherestr=wherestr & "and (vip like '%" & vip & "%') "
if vwhere <> "" then wherestr=wherestr & "and ((vwhere like '%" & vwhere & "%') or (vwheref like '%" & vwhere & "%')) "
if vos <> "" then vherestr=wherestr & "and (vos like '%" & vos & "%') "
if vsoft <> "" then wherestr=wherestr & "and (vsoft like '%" & vsoft & "%') "
if vcome <> "" then wherestr=wherestr & "and (vcome like '%" & vcome & "%') "
if vpage <> "" then wherestr=wherestr & "and (vpage like '%" & vpage & "%') "
'去除第一個查詢條件和 where 之間的 and
wherestr=replace(wherestr,"where and","where")
'如果沒有查詢條件,則查詢字串應為空
if trim(wherestr)="where" then wherestr=""
end if
'如果要查看的內容只有詳細記錄,則直接轉入詳細記錄頁
if outtype="詳細" then Response.Redirect "tj_all.asp?wherestr=" & server.URLEncode(wherestr)
'================================
'
' 主 程 序
'
'================================
'打開數據庫
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath(connpath)
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs = Server.CreateObject("ADODB.Recordset")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Copyright" content="Ajiang http://www.ajiang.net">
<title><%=countname%>-自定義統計</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin=5 rightmargin=0 leftmargin=0 vlink=#000000>
<!--#include file="inc_top.asp"-->
<br>
<table width=500 cellspacing=0 align=center>
<tr><td>
<p style="line-height: 100%; margin-left: 15; margin-top: 5; margin-bottom: 0">
恭喜: 下面顯示的就是您要查詢的內容的分析結果。</p>
</td></tr>
</table>
<br>
<%
'根據查詢條件輸出相應的內容
if instr(outtype,"小時") then
statname="24小時訪問分析"
tuwidth=15
thewhich="vhour"
tuhow=24
unit="時"
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"日") then
statname="日訪問分析"
tuwidth=13
thewhich="vday"
tuhow=31
unit="日"
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"周") then
statname="周訪問分析"
tuwidth=40
thewhich="vweek"
tuhow=7
unit=""
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"月") then
statname="月訪問分析"
tuwidth=20
thewhich="vmonth"
tuhow=12
unit="月"
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"年") then
statname="年訪問分析"
leftwidth=50
tuwhich="vyear"
statshu statname,leftwidth,tuwhich,wherestr
end if
if instr(outtype,"IP") then
statname="IP分析"
leftwidth=150
tuwhich="vIP"
statshu statname,leftwidth,tuwhich,wherestr
end if
if instr(outtype,"地區") then
statname="地區訪問分析"
leftwidth=100
tuwhich="vwhere"
statshu statname,leftwidth,tuwhich,wherestr
end if
if instr(outtype,"瀏覽器") then
statname="不同瀏覽器用戶訪問分析"
tuwidth=50
thewhich="vsoft"
tuhow=7
unit=""
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"操作系統") then
statname="不同操作系統用戶訪問分析"
tuwidth=50
thewhich="vOS"
tuhow=7
unit=""
statheng statname,tuwidth,thewhich,tuhow,unit,wherestr
end if
if instr(outtype,"來路") then
statname="來路分析"
leftwidth=220
tuwhich="vcome"
statshu statname,leftwidth,tuwhich,wherestr
end if
if instr(outtype,"頁面") then
statname="頁面點擊分析"
leftwidth=220
tuwhich="vpage"
statshu statname,leftwidth,tuwhich,wherestr
end if
'如果同時選擇了詳細,則提示點擊繼續
if instr(outtype,"詳細") then
%>
<table width="500" cellspacing="0" align="center" cellpadding="0" border="0">
<tr><td colspan="3"><img src="images/photoup.gif"></td></tr>
<form action="tj_all.asp" method=post id=form1 name=form1>
<tr height="30">
<td width="1" class="backs"></td>
<td width="498"class="backq">
<img src="images/tb_title.gif" align=absmiddle><font style="font-size:16px"> </font>∷∷∷ 查看詳細記錄 ∷∷∷<br>
<p class="p1">因為詳細記錄需要翻頁,不能和以上記錄放在同一頁,請點擊下面的繼續按鈕查看相應內容。
<p class="p1" style='margin-top: 0;' align="right">
<a href='javascript:document.forms[0].submit();'>繼續</a>
<input type="hidden" name="wherestr" value="<%=wherestr%>">
<input type="submit" value=" " name="save" class="backc2"><font style="font-size:16px"> </font>
</td>
<td width="1" class="backs"></td>
</tr>
</form>
<tr><td colspan="4"><img src="images/photodown.gif"></td></tr>
</table>
<br>
<%
end if
'保存數據表單
if session.Contents("master")=true or whatcan>=6 then
%>
<table width="500" cellspacing="0" align="center" cellpadding="0" border="0">
<tr><td colspan="3"><img src="images/photoup.gif"></td></tr>
<form action="tj_save.asp" method=post>
<tr height="30">
<td width="1" class="backs"></td>
<td width="498"class="backq">
<img src="images/tb_save.gif" align=absmiddle><font style="font-size:16px"> </font>∷∷∷ 保存這次檢索條件 ∷∷∷<br>
<p class="p1"><font class="fonts"><b>檢索條件</b></font> <%if wherestr="" then%>沒有檢索條件<%else%><%=wherestr%><%end if%>。
<p class="p1" style='margin-bottom: 0;margin-top: 0;'><font class="fonts"><b>查詢項目</b></font> <%=outtype%>。
<p class="p1" style='line-height: 100%;margin-bottom: 0;margin-top: 0;'><font class="fonts"><b>取個名字</b></font> <input name="name" size="16" class="input" value="<%=name%>">
<INPUT type="radio" name="overwrite" value="0"<%if name="" then%> checked<%end if%>> 同名時提示
<INPUT type="radio" name="overwrite" value="1"<%if name<>"" then%> checked<%end if%>> 同名時覆蓋
<p class="p1" style='line-height: 100%;margin-bottom: 0;margin-top: 0;'><font class="fonts"><b>加個介紹</b></font> <input name="content" size="50" class="input" value="<%=content%>">
<p class="p1" style='margin-top: 0;' align="right">
<a href="help.asp?id=002">幫助</a>
<a href='javascript:document.forms[0].submit();'>保存</a>
<input type="hidden" name="wherestr" value="<%=wherestr%>"><input type="hidden" name="outtype" value="<%=outtype%>"><input type="submit" value=" " name="save" class="backc2"><font style="font-size:16px"> </font>
</td>
<td width="1" class="backs"></td>
</tr>
</form>
<tr><td colspan="4"><img src="images/photodown.gif"></td></tr>
</table>
<br>
<%
end if
%>
<!--#include file="inc_bottom.asp"-->
</body>
</html>
<%
' 關閉數據庫
set rs=nothing
conn.Close
set conn=nothing
%>
<%
'******************************** 自定義函數和子程序 ********************************
'================================
'
' 輸出圖表數據的子程序(橫)
'
'================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -