淺淡如何用ASP實現線上人數統計

來源:互聯網
上載者:User
統計|線上|線上人數                 淺淡如何用ASP實現線上人數統計
        
                   (jaklin  2000.8.17)

    我發現這幾天問此問題的人挺多的。就此我想說說我個的用法, 請各位大蝦指教。

  線上人數是指一個時段內的訪客人數統計,時間的長短是由設計者設定的。

  在這個時段內,各個不同IP訪問本網站的總數,就是當前的線上人數。在ASP中,一般是使用Session對象來實現統計,實現代碼如下:

  1. 在Golobal.asa檔案中:

  〈SCRIPT LANGUAGE=″VBScript″ RUNAT=″Server″〉

  Sub Session_OnStart

      application(″online″)=application(″online″)+1

  End Sub

  Sub Session_OnEnd

      application(″online″)=application(″online″)-1

  End Sub

  sub Application_OnStart

      application(″online″)=0

  End Sub

  sub Application_OnEnd

      application(″online″)=0

  End Sub

  〈/SCRIPT〉

  2. Online.asp 檔案內容

  〈% tmp=application(″online″)

  tmp=Cstr(tmp)

  dim disp(20)

  dim images(20)

  dbbits=len(tmp)

  for i= 1 to dbbits

      disp(i)=left(right(tmp,i),i-(i-1))

  next

  for i=dbbits to 1 step -1

      images(i)=″〈img src=http://www.163design.net/a/q/″&″http://xxxx.com.cn/pic″&″/″&disp(i)&″.gif〉″

  response.write ″document.write(′ ″&images(i)&″ ′);″

  next %〉

    若那位大蝦有更好的方法, 也順便告訴我一下:fz_chenjl@163.net. OK? 



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.