<% mode = LCASE(Request("mode")) gif = Request("gif") Set conn = Server.CreateObject("ADODB.Connection") DBPath = Server.MapPath("counter.mdb") conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath SET rs = Server.CreateObject("ADODB.Recordset") Rs.Open "Select * From counters" , conn,1,3 LASTIP = RS("LASTIP") NEWIP = REQUEST.servervariables("REMOTE_ADDR") IF CSTR(Month(RS("DATE"))) <> CSTR(Month(DATE())) THEN RS("DATE") = DATE() RS("YESTERDAY") = RS("TODAY") RS("BMONTH") = RS("MONTH") RS("MONTH") = 1 RS("TODAY") = 1 RS.Update ELSE IF CSTR(Day(RS("DATE"))) <> CSTR(Day(DATE())) THEN RS("DATE") = DATE() RS("YESTERDAY") = RS("TODAY") RS("TODAY") = 1 RS.Update END IF END IF RS("TOTAL") = RS("TOTAL") + 1 RS("TODAY") = RS("TODAY") + 1 RS("MONTH") = RS("MONTH") + 1 RS.Update response.write "本站瀏覽總人數:" GCounter( RS("TOTAL") ) response.write "
" response.write "今日瀏覽總人數:" GCounter( RS("TODAY") ) response.write "
" response.write "昨日瀏覽總人數:" GCounter( RS("YESTERDAY") ) response.write "
" response.write "本月瀏覽總人數:" GCounter( RS("MONTH") ) response.write "
" response.write "上月瀏覽總人數:" GCounter( RS("BMONTH") ) response.write "
" response.write "" response.write "" N = Now D2 = DateValue(N) D1 = #03/05/1999# ' 網站開站日期(月/日/西元) response.write "開站至今天數:" GCounter( DateDiff("d", D1, D2) ) response.write "
" D3 = DateDiff("d", D1, D2) 'response.write "平均一日人數:" 'GCounter( RS("TOTAL")\D3 ) CONN.CLOSE Function GCounter( counter ) Dim S, i, G S = CStr( counter ) ' 先將數值轉成字串 S ' 逐一取出字串 S 的每一個字元,然後串成 的圖形標示 For i = 1 to Len(S) G = G & "" Next response.write G End Function %>