<% ' Script adds page hits to your database ' Add this on every page you want to count ' Of course you can retrieve the values and display them on any page ' dim curcount thisURL = "ramcon\default.asp" Set cnn1 = Server.CreateObject("ADODB.Connection") openStr = "driver={Microsoft Access Driver (*.mdb)};" & _ "dbq=" & Server.MapPath("..\db\pageCounters.mdb") cnn1.Open openStr,"","" sql = "SELECT url, hitcnt, lasthit " & _ "FROM hitcounts " & _ "WHERE url = '" & thisURL & "';" Set recordHits= Server.CreateObject("ADODB.Recordset") recordHits.Open sql, cnn1, 2, 2, 1 If recordHits.EOF Then recordHits.AddNew recordHits("url") = thisURL curCount = 1 Else curCount = recordHits("hitcnt") + 1 end If recordHits("hitcnt") = curCount recordHits("lasthit") = Now() recordHits.Update recordHits.Close set recordHits = Nothing sql = "SELECT url, hitcnt, lasthit " & _ "FROM hitcounts " & _ "WHERE url = 'ramcon\default.asp';" Set recordHits= Server.CreateObject("ADODB.Recordset") recordHits.Open sql, cnn1, 2, 2, 1 If recordHits.EOF Then defcount = 0 else defCount = recordHits("hitcnt") end If cnn1.Close set cnn1 = Nothing %> Ramsey Constructions Pty Ltd
Ramsey Constructions

BUILDERS & PROJECT MANAGERS
ABN 88 143 696 655 LICENCE NO 231398
DESIGN & CONSTRUCT / BUILDING SERVICE
FOR
COMMERCIAL - INDUSTRIAL - OFFICE FIT OUTS - RESIDENTIAL

Master Builers Master Builders Green Living

There has been
<%=defCount%>
visitors to this site