<% CountFile = Server.MapPath("counter/count_physical.txt") '**注意count.txt的路徑 Set FileObject = Server.CreateObject("Scripting.FileSystemObject") Set Out= FileObject.OpenTextFile (CountFile, 1, FALSE, FALSE) counter = Out.ReadLine Out.Close if isEmpty(session("login")) then '如果session("login")是空白表示未瀏覽 , application("count")瀏覽人數加1 SET FileObject = Server.CreateObject("Scripting.FileSystemObject") Set Out= FileObject.CreateTextFile (CountFile, TRUE, FALSE) '**注意count.txt寫入的權限 Application.lock '瀏覽人數加1前先鎖定 counter= counter + 1 Out.WriteLine(counter) Application.unlock '鎖定解除 Out.Close session("login") = True '將session("login")設為真值True , 表示該使用者已瀏覽 end if Length=Len(counter) ImgStr="" for i=1 to 5 - Length ' 計數器預設 5 位數 , 不滿以 0 補足 ImgStr1=""+ImgStr1 '**注意圖檔路徑 next do while Length>=1 ' 將數字轉成對應的圖檔名稱 ImgStr2=""+ImgStr2 Length=Length-1 loop ImgStr=ImgStr1+ImgStr2 %>