奧修文教中心 電話:03-5822230 聯絡人: 范雅綺 行動電話:0935089456

地址:新竹縣竹東鎮二重里自由街7號3樓  http://www.osho.com.tw E-mail:eshana@osho.com.tw

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