Print Page | Close Window

IP Counter

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6892
Printed Date: 31 March 2026 at 4:31pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: IP Counter
Posted By: Step
Subject: IP Counter
Date Posted: 31 October 2003 at 5:38pm

Hello everybody.

Does anyone know why this code doesn't work well?
It is sending data to my .mdb file, that is not the problem.
But is doesn't display data on the page. I want to display the number of visitors with graphics.
Thank you very much!!!

 

<%
  Dim Conn
  Dim RS
  Dim TotalVisited
  Dim ImgSequence
  Dim CharToReplace
  Dim Query

  Set Conn = Server.CreateObject("ADODB.Connection")
  Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("hit_counter.mdb")

  Set RS = Server.CreateObject("ADODB.Recordset")

  Query = "SELECT * FROM Hits WHERE Hit_IP='" & Request.ServerVariables("REMOTE_ADDR") & "' AND Hit_Date=#" & DATE() & "#"
  RS.Open Query, Conn, 3, 3

  IF RS.EOF AND RS.BOF THEN
    RS.AddNew
    RS("Hit_Date") = Date()
    RS("Hit_Time") = Time()
    RS("Hit_IP") = Request.ServerVariables("Remote_Addr")
    RS.Update
  END IF

  RS.Close

  Select Case Request.QueryString ("Mode")


  Case "Graphic"

    RS.Open "SELECT COUNT (*) AS TotalVisits FROM Hits", conn, 3, 3

    If Not RS.Eof and NOT RS.Bof Then

      TotalVisits = Rs("TotalVisits")
      RS.Close

      For I = 1 to Len (TotalVisits)

        CharToReplace = Mid(TotalVisits, I, 1)
        ImgSequence = ImgSequence & "<img src='" & CharToReplace & ".gif' Border=0>" 

      Next

      Response.Write ImgSequence

    Else

       Response.Write "<img src='0.gif' border=0>"

    End If

  End Select
%>




Replies:
Posted By: Mart
Date Posted: 04 November 2003 at 10:59am

Well your not giving us the error so i assume there wasnt one

Try changing

IF RS.EOF AND RS.BOF THEN

To

If Not RS.Eof Then

Mart.



Posted By: Step
Date Posted: 04 November 2003 at 11:09am

You're right, I have no error message, I just see a blank page.

I'll try to do what you're saying. Thank you very much!!!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net