% 'Dimension variables Dim adoCon11 'Database Connection Variable Dim adoRec 'Database Recordset Variable Dim strAccessDB 'Holds the Access Database Name Dim strSQL11 'Database query sring Dim intRecordPositionPageNum1 'Holds the record position Dim intRecordLoopCounter1 'Loop counter for displaying the database records Dim intTotalNumDBEntries 'Holds the total number of records in the database Dim intTotalNumDBPages 'holds the total number of pages in the database Dim intLinkPageNum1 'Holds the page number to be linked to Dim strHitsPageName 'Holds the page name of the file with the hit counter Dim lngTotalCounter 'Holds the total vistitor counter Dim dtmTotalCounterDate 'Holds the date the visitor counter is from Dim lngResetCounter 'Holds the visitor count number since reset Dim dtmResetCounterDate 'Holds the date the reset counter was reset Dim blnAllCountersSelected 'Set to true if the user has choosen to select all counters Dim intDay 'Holds the integer number for the day Dim intMonth 'Holds a integer number from 1 to 12 for the month Dim intYear 'Holds the year Dim strConHC 'Declare constants Const intRecordsPerPage1 = 1 'Change this number to the amount of database entries to be displayed on each page 'Initalise variables blnAllCountersSelected = False 'If this is the first time the page is displayed then the dayabase record position is set to page 1 If Request.QueryString("PagePosition") = "" Then intRecordPositionPageNum1= 1 'Else the page has been displayed before so the database record postion is set to the Record Position number Else intRecordPositionPageNum1= CInt(Request.QueryString("PagePosition")) End If 'If the user has choosen to selct all visitor counters then set the variable blnAllCountersSelected to True If Request.QueryString("mode") = "SelectAll" Then blnAllCountersSelected = True 'Initialise the strAccessDB variable with the name of the Access Database 'strAccessDB = "" 'Create a connection odject Set adoCon11 = Server.CreateObject("ADODB.Connection") Set adoRec = Server.CreateObject("ADODB.Recordset") '------------- 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) 'strConHC = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strAccessDB) 'strConHC = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & strAccessDB 'strConHC = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strEzDBPath2) '"../db/ez.mdb" strConHC = strCon 'Alternative drivers faster than the basic one above 'strConHC = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath(strAccessDB) 'This one is if you convert the database to Access 97 'strConHC = "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) 'strConHC = "DSN=forum" 'Place the DSN name after the DSN= '--------------------------------------------------------------------------------------------------------------------------------------------- 'Open a connection to the database adoCon11.Open strConHC 'Initalise the strSQL11 variable with an SQL statement to query the database by selecting all tables ordered by the decending date strSQL11 = "SELECT * FROM tblHitCount " 'Set the cursor type property of the record set to Dynamic so we can navigate through the record set adoRec.CursorType = 3 'Query the database adoRec.Open strSQL11, adoCon11 'Set the number of records to display on each page by the constant set at the top of the script adoRec.PageSize = intRecordsPerPage1 'Get the database record position to display from If NOT adoRec.EOF Then adoRec.AbsolutePage = intRecordPositionPageNum1 'Count the number of enties in the database intTotalNumDBEntries = CInt(adoRec.RecordCount) 'Count the number of pages there are in the database calculated by the PageSize attribute set above intTotalNumDBPages = CInt(adoRec.PageCount) ' loop through the records in the database and show the infomation ' using a Do While...Loop statement For intRecordLoopCounter1 = 1 to intRecordsPerPage1 'If there are no visitor counter records left to display then exit loop If adoRec.EOF Then Exit For 'Read in the values form the database strHitsPageName = adoRec("Page") 'lngTotalCounter = CLng(adoRec("Total_Counter")) lngTotalCounter = CLng(adoRec("Reset_Counter")) dtmTotalCounterDate = adoRec("Total_Date") lngResetCounter = CLng(adoRec("Reset_Counter")) dtmResetCounterDate = CDate(adoRec("Reset_Date")) intDay = CInt(Day(adoRec("Total_Date"))) intMonth = CInt(Month(adoRec("Total_Date"))) intYear = CInt(Year(adoRec("Total_Date"))) 'Display the visitor counters in HTML If lngTotalCounter = 1 Then Response.Write vbCrLf & "