home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / Code / ch39 / homepage.asp < prev    next >
Encoding:
Text File  |  1997-09-21  |  857 b   |  26 lines

  1. <html>
  2. <head><TITLE>Our Home Page</TITLE></head>
  3. <body>
  4. <Our Page's Content>
  5. <%
  6. Set Conn=Server.CreateObject("ADODB.Connection")
  7. Set RSCounter = Server.CreateObject("ADODB.Recordset")
  8. Conn.Open "DSN=Counter"
  9. SQL = "Select * from Pages "
  10. SQL = SQL & "Where Pages.Page='"
  11. SQL = SQL & Request.ServerVariables("PATH_TRANSLATED") & "'"
  12. RSCounter.Open SQL, Conn, 1, 2
  13. If RSCounter.EOF Then 'There is no record for this page
  14.      RSCounter.AddNew
  15.      RSCounter("Page") = Request.ServerVariables("PATH_TRANSLATED")
  16.      RSCounter("Hits") = 1
  17.      Response.Write "<p><strong>This page has been visited one time</strong></p>"
  18. Else
  19.      RSCounter("Hits") = RSCounter("Hits") + 1
  20.      Response.Write "<p><strong>This page has been visited " & RSCounter("Hits") & " times</strong></p>"
  21. End if
  22. RSCounter.Update
  23. RSCounter.Close
  24. %>
  25. </body>
  26. </html>