<% Dim Cnn Set Cnn = Server.CreateObject("ADODB.Connection") Cnn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("count.mdb") dim uip,uie uip = Request.ServerVariables("remote_addr") uie = request.servervariables("http_user_agent") dim rs1,jsqsql,jsqtype jsqtype = "2" Rem 这里选择计数方式 Rem jsqtype = "1",每刷新一次,计数+1 Rem jsqtype = "2",每访问一次计数+1,刷新不增加 Rem jsqtype = "3",每一IP,一日之内只记录一次,再次访问,刷新均不增加 if jsqtype="1" then jsqsql = "insert into jsq (visitdate,visittime,userip,userie) values (date(),time(),'"&uip&"','"&uie&"')" cnn.execute jsqsql set jsqsql = nothing elseif jsqtype="2" then if session("jsqhascount")<>"hascount" then jsqsql = "insert into jsq (visitdate,visittime,userip,userie) values (date(),time(),'"&uip&"','"&uie&"')" cnn.execute jsqsql set jsqsql = nothing session("jsqhascount")="hascount" end if elseif jsqtype="3" then set rs1 = Server.CreateObject("ADODB.RecordSet") rs1.open "select id from jsq where visitdate=#"&date()&"#",cnn,1,1 if rs1.eof then rs1.close set rs1=nothing jsqsql = "insert into jsq (visitdate,visittime,userip,userie) values (date(),time(),'"&uip&"','"&uie&"')" cnn.execute jsqsql set jsqsql = nothing end if end if dim jsq,totalhits,Length set jsq = Server.CreateObject("ADODB.RecordSet") jsq.open "select id from jsq",cnn,1,1 totalhits = jsq.recordcount jsq.close set jsq=nothing cnn.close set cnn=nothing Length = Len(totalhits) do until length >= 8 totalhits = "0" & totalhits length = length + 1 loop for i = 1 to Length %> document.write(''); <% next %>