使用了imagelib组件!
1
2site_id=Request.QueryString("site_id")
3if isempty(site_id) then
4Response.End
5end if
6
7Set Sistema = CreateObject("Scripting.FileSystemObject")
8set ILIB = server.createobject("Overpower.ImageLib")
9path=server.MapPath("../保存计数文件的路径/")
10CounterFile=path & "\count_"& site_id &".txt"
11contagem = 0
12if Sistema.FileExists(counterfile) then
13Set arquivo = Sistema.GetFile(counterfile)
14Set texto = arquivo.OpenAsTextStream(1, -2)
15contagem = texto.readline
16texto.close
17end if
18contagem = contagem + 1
19
20Set texto = sistema.CreateTextFile(counterfile, true, false)
21texto.writeline contagem
22texto.close
23
24texto = contagem
25if contagem > 1 then texto = texto
26textolen=len(texto)
27for i=1 to 8-textolen
28texto="0" & texto
29next
30
31ILIB.FontColor = "#00ff00" '字体色
32ILIB.BrushColor = "#000000" '背景色
33'ILIB.FontFace = "Verdana"
34'ILIB.FontFace = "Checkers"
35ILIB.FontSize = 8
36ILIB.FontBold = false
37ILIB.width = ILIB.GetTextwidth(texto)+5
38ILIB.height = ILIB.GetTextHeight(texto)+5
39ILIB.PenColor = "#307C3B" '边框色
40ILIB.Box 1,1,ILIB.WIDTH,ILIB.HEIGHT
41ILIB.Textout texto,3,3
42
43ILIB.Textout "",ILIB.width/2 - tamanho/2,10
44
45ILIB.PictureBinaryWrite 2, 0, ""
46
47Set Sistema =nothing
48set ILIB =nothing
49Set arquivo = nothing
50Set texto = nothing
本计数器使用了ImageLib组件,在使用程序前需要先注册该组件;
假如说你将文件保存为count.asp,然后在与count.asp,然后通过下面代码引用本计数器:
1<img border="0" src="path/count.asp?site_yoursite"/>
你也可以直接引用本站的计数器程序,代码如下:
1<a alt="网络精英" href="http://www.chinanetboy.com/" target="_blank"><img border="0" src="http://www.chinanetboy.com/scripts/count.asp?site_id=你的域名"/></a>
不过使用之前请发个email给我,免得我在清理的时候将你的数据删了 :)
计数器程序代码请看这里http://www.chinanetboy.com/website/read.asp?id=123;