can some one please help me with this code im trying to get here.. I am having it so when someone visits my site it checks for a ip and ads it to the database. I think my main problem here is my sql entry though because its made for if a ip already exists...
error '80020009'
Exception occurred.
/Default.asp, line 10
My code:
<!--#include virtual="include/database/connect.asp"-->
<%
'Ip logger/blocker
Dim IPADDRESS
IPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If IPADDRESS = "" Then IPADDRESS = Request.ServerVariables("REMOTE_ADDR")
strSQL = "SELECT * From ip where ip like '" & IPADDRESS & "'"
rsportal.Open strSQL, adoCon
if rsportal("ip") = "" then
rsportal.AddNew
rsportal.Fields("ip") = IPADDRESS
rsportal.Fields("log") = "0"
rsportal.fields("lastvisit") = formatdate(strdate, 0) & " @ " & time()
rsportal.fields("blocked") = FALSE
rsportal.Update
else
Do while not rsportal.eof
rsportal("log") = rsportal("log") + 1
rsportal("lastvisit") = formatdate(strdate, 0) & " @ " & time()
loop
end if
if rsportal("blocked") = TRUE then
response.redirect "banned.asp"
else
%>
<META HTTP-EQUIV="REFRESH" CONTENT="3; URL=index.asp">
<%
end if
if rsportal("theme") = "" then
rsportal("theme") = "default"
%>
<link rel="stylesheet" href="theme/<%=rsportal("theme")%>/style.css" type="text/css">
<%
else
end if
Set rsportal = Nothing
%><!--#include virtual="include/database/disconnect.asp"-->