重新整理|檔案名稱 重新整理幀:檔案名稱fresh.asp
<%
Option Explicit
dim msg,tmsg,ws,action,user,whoto,tcolor,kicklist,chatpoin,chatcomm,chatdata,sendid,i,reciid
dim tsecretly,thidename,dispstr,tchatpoin,tuserpoin,tchatcomm,j
dim sendname,address1,reciname
user=request("user")
whoto=request.form("whoto")
tmsg=request.form("SAYS")
tmsg=replace(tmsg,"\","\\")
tmsg=replace(tmsg,",","\,")
tmsg=replace(tmsg,"<","<") '屏蔽所有的Html標記
tmsg=replace(tmsg,"<img","<img") '放開<img標記
tmsg=replace(tmsg,"<b","<b") '放開<b標記
if request.form("ws")="on" then
ws=true
else
ws=false
end if
kicklist=application("kicklist")
'是否被踢使用者
if instr(kicklist,"'#"&user&"'")>0 then
response.write "<script>parent.top.location='kickout.htm';</script>"
response.end
end if
if instr(kicklist,"'"&Request.ServerVariables("remote_addr")&"'")>0 then
response.write "<script>parent.top.location='kickout.htm';</script>"
end if
chatpoin=application("chatpoin") '聊天室指標
chatcomm=application("chatcomm") '聊天室內容
chatdata=application("chatdata") '聊天室使用者資料
sendid=-1
reciid=-1
for i=0 to 50
if chatdata(i,0)=user and chatdata(i,1)=Request.ServerVariables("remote_addr") then sendid=i '注意,在些檢查IP地址,預防被穿牆
if chatdata(i,0)=whoto then reciid=i
next
if sendid=-1 then
response.write "使用者沒有進入聊天室"
response.end
end if
chatdata(sendid,4)=(chatdata(sendid,4) mod 104) '置標誌,預防被自動踢出聊天室
msg=right(time,8)&","&user&","&request.form("action")&","&whoto&","&request.form("color")
if ws then
msg=msg&",1"
else
msg=msg&",0"
end if
msg="'"&msg&","&tmsg
if reciid=-1 and whoto<>"所有人" then ws=true:reciid=sendid:msg=msg&"<font color=red>("&whoto&"不在此聊天室)</font>"
msg=msg&"'<br>"
if tmsg<>"" then
if ws then '耳語
if whoto<>"所有人" then chatdata(sendid,3)=chatdata(sendid,3)&msg
if reciid<>-1 and sendid<>reciid then chatdata(reciid,3)=chatdata(reciid,3)&msg
application.lock
application("chatdata")=chatdata
application.unlock
end if
if not ws or ws and whoto="所有人" then '屬於全部人的資料
if chatpoin=49 then
chatpoin=0 '數組回頭,迴圈調用
call checkname
else
chatpoin=chatpoin+1
end if
chatcomm(chatpoin)=msg '將內容寫進application內
application.lock
application("chatcomm")=chatcomm
application("chatpoin")=chatpoin
application.unlock
end if
end if
%><meta http-equiv="refresh" content="3; URL=refresh.asp?user=<% =user %>"><%
tsecretly=chatdata(sendid,3) '取私聊內容
thidename=chatdata(sendid,5) '取隱藏名單
dim tmpstr
if tsecretly<>"" then '顯示私聊內容
response.write thidename
dispstr=""
dim temps
tsecretly=split(tsecretly,"<br>")
for i=0 to ubound(tsecretly)-1
tmpstr=split(tsecretly(i),",")
if instr(thidename,",'"&tmpstr(3)&"'")<1 then dispstr=dispstr&","&replace(tsecretly(i),"<br>","")
next
chatdata(sendid,3)="" '清空私聊內容
end if
tuserpoin=chatdata(sendid,2) '使用者指標
tchatpoin=chatpoin