新疆网站建设 乌鲁木齐网页设计
 
欢迎您!
 您现在位置:华维时代科技技术中心网络编程- 浏览正文 网站快速导航: 
即时显示当前页面浏览人数

online.asp文件
<!--#include file="dbconn.asp" -->
<%
onlineTimeout=10       ''定义在线活动时间的时间间隔
Function Userip()
    GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")             ''''''''''''''''''''''获得用户的虚拟IP地址
    If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then
        GetClientIP = Request.ServerVariables("REMOTE_ADDR")                   ''''''''''如果未使用代理服务器,就获得来源的IP地址
    End If
    Userip = GetClientIP
End Function
sql="select o_id from c_online where o_ip='' "&Userip()&" '' "           在数据库中查找所获得 的IP地址的id
Set rs=conn.execute(sql)
If rs.eof and rs.bof Then
       sql="insert into c_online(o_ip) values('' "&Userip()&" '')"         如果数据库中没有就表明是新IP,那么插入操作
       conn.execute(sql)
Else
       sql="update c_online set o_ltime=now() where o_ip='' "&Userip()&" '' "        更数据库的当前时间
       conn.execute(sql)
End If
sql="delete from c_online where dateadd(''s'',"&onlineTimeout*60&",o_ltime) < now()"        定义十分钟刷新
conn.execute(sql)
rs.close
Set rs=nothing
Function allonline()
       tmprs=conn.execute("Select count(o_id) from c_online")
       allonline=tmprs(0)
       set tmprs=nothing
end Function
%>
<%Response.Write "document.write(""在线"&allonline()&"人"")"%>

关于我们 | 人才招聘 | 常见问题 | 在线留言 | 技术中心 | 网站案例 | 联系方式
 
版权所有 ©2005-2010乌鲁木齐华维时代科技信息有限公司,严禁抄袭复制
公司地址:新疆乌鲁木齐市北园春克拉玛依西路汇嘉园 新ICP备05004410号
咨询电话:0991-8787177 8787997 E-mail:info@xjhuawei.com
本站关键字:新疆网站建设 新疆网页设计 新疆网络公司 乌鲁木齐建网站 乌鲁木齐网站建设
公司营业执照验证