codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  IP Counter  Step at 17:51 on Saturday, November 01, 2003
 

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='/forum/0.gif' border=0>"

End If

End Select
%>








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  grouping records
•  loop through form checkboxes
•  Java Help
•  Pre-load Rotating Photographs
•  need help to customize a dhtml script.
•  Implementing setTimeout causing problems
•  setTimeout for custom objects
•  How to change dynamically the value of CONTENTof META object ?
•  How to change the value of CONTENTof META object ?


Recent Articles
Simple Thumbnail Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)
Function to Return Alpha Characters Only
The OSI Reference Model - A Clear and Concise Illustration !


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2004