<%@ Language=VBScript codepage ="936" %>
<%
dim conn 
dim connstr
on error resume next
connstr="DBQ="+server.mappath("visited.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr 

ID=Cint(Request.QueryString)
If ID>10000 and Isnumeric(ID) then
ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR") 
set rs= Server.CreateObject("ADODB.Recordset") 
sql="select * from visited where ip='"&ip&"' and cint(now()-lasttime)<1"
rs.open sql,conn,1,1
if not rs.eof then
'Conn.Execute("Deleted from visited where cint(now()-lasttime)>1")
server.Transfer("index.asp")
else
Session("Vis_ID")=ID
'Conn.Execute("Deleted from visited where cint(now()-lasttime)>1")
Conn.Execute("Insert Into visited (ip,lasttime) VALUES('"&ip&"',now())")
response.Redirect("visited.asp")
end if
else
server.Transfer("index.asp")
end if
rs.close
set rs=nothing
%>