<%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%> <% s1="早安" cpic="1" if hour(now)>=12 and hour(now)<=17 then s1="午安" cpic="2" end if if hour(now)>=18 then s1="晚安" cpic="3" end if s2=" , 您好 ! 歡迎光臨 ! NasalGuard-阻鼻敏官方網站!" ss=s1 & s2 %> 101wct
<% 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(RS("DATE")) <> CSTR(DATE()) THEN ' 如果日期已過了一天 RS("DATE") = DATE() ' 將日期改為今天 RS("YESTERDAY") = RS("TODAY") ' 將今日人數與昨日人數交換 RS("TODAY") = 1 ' 重新計算今日登入人數 RS.Update ' 儲存資料 END IF IF LASTIP <> NEWIP THEN ' 比對 IP ,不使用灌水式 RS("TOTAL") = RS("TOTAL") + 1 ' 總數加一 RS("TODAY") = RS("TODAY") + 1 ' 重新計算今日登入人數 RS("LASTIP") = NEWIP ' 將新登入者的 IP 寫入 RS.Update ' 儲存資料 END IF response.write "瀏覽總數: " GCounter( RS("TOTAL") ) response.write " 今日人數: " GCounter( RS("TODAY") ) response.write "  昨日人數: " GCounter( RS("YESTERDAY") ) 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 %>