www.gusucode.com > 漂亮的地方旅游景点景观介绍网站源代码 > inc/online.asp
<!--#include file="config.asp" --> <% '获取客户端IP Function Userip() Dim GetClientIP GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then GetClientIP = Request.ServerVariables("REMOTE_ADDR") end if Userip = GetClientIP End function dim ip,i fid=Trim(Request.QueryString("fid")) '版面参数 ip=userip() dim sf '检测当天是否有该IP存在 set rs=conn.execute("select count(id) as tol from tongji2 where mytime like '%"&date()&"%' and ip='"&ip&"'") sf=rs("tol") call recordend(rs) if sf=0 then'更新统计表 call record(rs,"select top 1 * from tongji order by id desc",3) if not rs.eof then if year(rs("mytime"))=year(now) and month(rs("mytime"))=month(now) and day(rs("mytime"))=day(now) then rs("tj")=rs("tj")+1 rs.update else rs.addnew rs("tj")=1 rs("mytime")=now() rs.update end if else rs.addnew rs("tj")=1 rs("mytime")=now() rs.update end if conn.execute("insert into tongji2 (ip,fid) values ('"&ip&"',"&rs("id")&")") call recordend(rs) end if set rs=conn.execute("select count(ip) as tol from online where ip='"&ip&"'") if rs("tol")=0 then i="yes" else i="no" end if call recordend(rs) if i="yes" then conn.execute("insert into online (ip,fid) values ('"&ip&"',"&fid&",now())") else conn.execute("update online set ctim=now(),fid="&fid&" where ip='"&ip&"'") end if conn.execute("delete * fromonline where ctim<dateadd('n',"&-sstt&",now())") call connend() %>