%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%'访客实时跟踪
'------------获取客户端ip地址始--------------
Dim userip,lx
lx="I"'I为index的缩写
'若客户使用代理服务器来访问时,透过代理服务器用HTTP_X_FORWARDED_FOR读取真实ip地址
userip=Request.ServerVariables ("HTTP_X_FORWARDED_FOR")
if userip="" then '若客户端不是使用代理服务器来访问(即代理服务器的值为空)时,用REMOTE_ADDR读取真实ip地址
userip = Request.ServerVariables("REMOTE_ADDR")'用REMOTE_ADDR读取真实ip地址
end if
'------------获取客户端ip地址终--------------
sql="select userip from keyword_unfind where userip='"&userip&"' and lx='I'"
set rs=conn.execute(sql)
if rs.eof then
'把记录到数据库中,以便知道哪个在访问首页,第1次访问hits为1
sql_int="insert into keyword_unfind (keywords,lx,userip,hits) values ('首页访问','I','"&userip&"','1')"
'类型为"I"--表示访问的是首页
set rs_int=conn.execute(sql_int)
else'如果不是第1次访问首页的,则把其点击次数加1,同时把最后1次访问时间记录下来
sql_up="update keyword_unfind set hits=hits+1,infotimeup='"&date()+time()&"' where userip='"&userip&"'and lx='I'"
set rs_up=conn.execute(sql_up)
end if
sql_cp="select *from chanpin where BigClassName<>'价格区间' order by ID DESC" '首页搜索框显示的内容用
Set rs_cp = Server.CreateObject("ADODB.Recordset")
rs_cp.Open sql_cp,conn,1,1
%>