
We can provide the solution to suit your individual needs. Whether it's a simple home page, or a complex site with all the bells & whistles, Proline Computer Web Design and Hosting has the answers! |
With our one stop shopping for design, hosting and maintance it has never been easier to join the Information Superhighway . |
![]() ![]() ![]() ![]() ![]() |
Bill Roland
<%
'This function returns an open connection to the access database.
Function GetDBConnection()
Dim databasePath, connectionString
'MODIFY: Specify the relative path to the database file.
databasePath = ".\HitCounter.mdb"
'Connect to the Access database using a DSN-Less connection
Set GetDBConnection = Server.CreateObject("ADODB.Connection")
connectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath(databasePath)
GetDBConnection.Open connectionString
End Function
'This function will return the current hit count for the page specified by pageName.
' If incrementHitCount (boolean) is true, the it will first add one to the current hit count.
Function GetCurrentHitCount(pageName, incrementHitCount)
Dim con, rs, sql, currentHitCount
'Get the database connection
Set con = GetDBConnection()
'Get the current hit count
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM tblHitCount WHERE PageName = '" + pageName + "'"
rs.Open sql, con, 2, 3
If (rs.EOF) Then
'No count was found, create a new record and start the count at 0
rs.AddNew()
rs("PageName") = pageName
rs("CurrentHitCount") = 0
rs.Update()
End If
'Get the current hit count from the database
currentHitCount = rs("CurrentHitCount")
If (incrementHitCount) Then
'Add one to the current hit count before retrieving it
currentHitCount = currentHitCount + 1
rs("CurrentHitCount") = currentHitCount
rs("LastAccessed") = Date()
rs.Update()
End If
'return the hit count
GetCurrentHitCount = currentHitCount
'Clean up database objects
rs.Close()
con.Close()
Set rs = Nothing
Set con = Nothing
End Function
'This function will display any number graphically (using images). The parameter
' 'digits' is the number of digits to display.
Function ShowNumberGraphically(num, digits)
Dim numImage(10), i
'MODIFY: Here is where the files for each digit are declared
i = 0
While i < 10
numImage(i) = "/images/digit_" & i & ".gif"
i = i + 1
Wend
'MODIFY: Use the code below (instead of the while loop above) if
' you want more explicit control over the name of each file.
'numImage(0) = "digit_0.gif"
'numImage(1) = "digit_1.gif"
'numImage(2) = "digit_2.gif"
'numImage(3) = "digit_3.gif"
'numImage(4) = "digit_4.gif"
'numImage(5) = "digit_5.gif"
'numImage(6) = "digit_6.gif"
'numImage(7) = "digit_7.gif"
'numImage(8) = "digit_8.gif"
'numImage(9) = "digit_9.gif"
i = digits - 1
While i >= 0
If (i < Len(num)) Then
%><%
Else
%>
<%
End If
i = i - 1
Wend
End Function
%>