<% @ Language=VBScript %> <% Option Explicit %> <% 'Set the response buffer to true as we are redirecting Response.Buffer = True 'If the user is admin forward to setup If intGroupID <> 1 Then Response.Redirect("../default.asp") End If 'Dimension variables Dim adoCon 'Database Connection Variable Dim adoRec Dim strConHA 'Holds the Database driver and the path and name of the database Dim strAccessDB 'Holds the Access Database Name Dim strSQL6 'Database query string Dim saryPageName 'Holds the names of the pages for the counters to be reset 'Error handler 'On error resume next 'Initialise the strAccessDB variable with the name of the Access Database 'strAccessDB = "" 'Create a connection odject Set adoCon = Server.CreateObject("ADODB.Connection") '------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below -------------- 'Database connection info and driver (if this driver does not work then comment it out and use one of the alternative drivers) 'strConHA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'strConHA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strAccessDB strConHA = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strEzDBPath2) '"../db/ez.mdb" 'Alternative drivers faster than the basic one above 'strConHA = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath(strAccessDB) 'This one is if you convert the database to Access 97 'strConHA = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(strAccessDB) 'This one is for Access 2000 'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers) 'strConHA = "DSN=forum" 'Place the DSN name after the DSN= '--------------------------------------------------------------------------------------------------------------------------------------------- 'Set an active connection to the Connection object adoCon.Open strConHA 'Create a ADO recordset odject for the database Set adoRec = Server.CreateObject("ADODB.Recordset") 'Set the Lock Type for the records so that the record set is only locked when it is deleted adoRec.LockType = 3 'Run through till all checked hit counters are deleted For each saryPageName in Request("chkPageName") 'Initalise the strSQL6 variable with the SQL string to reset the reset hit counter strSQL6 = "SELECT tblHitCount.* " strSQL6 = strSQL6 & "FROM tblHitCount " strSQL6 = strSQL6 & "WHERE tblHitCount.Page ='" & saryPageName & "';" 'Open the recorset adoRec.Open strSQL6, strConHA 'Place the values into the recordset adoRec.Fields("Reset_Counter") = 0 adoRec.Fields("Reset_Date") = Now() 'Write to the database adoRec.Update 'Close the recordset adoRec.Close Next 'Close Server Objects Set adoCon = Nothing Set adoRec = Nothing 'Redirect back to the visitor counter admin page Response.Redirect"admin.asp" %>