README.md

December 4, 2022 ยท View on GitHub

Get IP ADDRESS

Description

This is usefull program to track people's IP.

Visit Count for each visiting IP address. Assume that the table IPAddresses(IPAddress, Count) exists in the DSN yourDSN.

More Info

Submitted On
Byvsim
LevelIntermediate
User Rating4.4 (22 globes from 5 users)
CompatibilityASP (Active Server Pages)
CategoryASP Server Object Model
WorldASP / VbScript
Archive File

Source Code

<html>
<head>
<title>Visit Counts per ip addresses</title>
</head>
<body>
<%
'  Get Remote IP Address.
IPAddress = Request.ServerVariables("Remote_Addr")
'  Open database connection.
Set conn = Server.CreateObject("adodb.connection")
conn.open "yourDsn"
'  Check to see the IP address exits.
'  Inefficient: to be modified.
sql = "select * from IPAddresses" & _
   " where IPAddress = '" & IPAddress & "'"
set result = conn.execute(sql)12:09 AM 8/8/01
if (not result.eof) then ' one result
  Count = Clng(result.fields.item("Count")) + 1
  sql = "update IPAddresses set Count = " & Count & _
     " where IPAddress = '" & IPAddress & "'"
else
  Count = 1
  sql = "insert into IPAddresses values('" & _
     IPAddress & "', " & Count & ")"
end if
conn.execute(sql)
conn.close
'  Print result.
Response.write("IP Address " & IPAddress & " has visited " & _
"this page for " & count & " times.")
%>
</body>
</html>