实现聊天室的悄悄话功能(上)(转贴)

80酷酷网    80kuku.com

  聊天室'取得说话内容,并过滤其中的脚本语句   
usersays=request.form("says")   
if instr(usersays,"《script")》0 then   
usersays=""   
end if   
  
'判断是否有谈话内容,没有的话就不作处理   
if len(usersays)《》0 then   
session("whoto")=request.form("whoto")   
session("action")=request.form("action")   
if instr(usersays,chr(39))》0 then   
usersays=replace(usersays,chr(39),"\"&chr(39))   
end if   
if instr(usersays,chr(34))》0 then   
usersays=replace(usersays,chr(34),"\"&chr(34))   
end if   
  
application.lock   
  
'定义一个交谈缓冲区,后面将给大家仔细分析一下   
  
dim chats(20)   
for n=1 to 20   
chats(n)=application("chats")(n)   
next   
username=request.Form("user")   
  
  
usertime=Time   
usertime="("&right(usertime,8)&")"   
user_whoto=request.Form("whoto")   
user_action=request.Form("action")   
if application("counter")》19 then   
application("counter")=0   
end if   
'不是耳语就加一   
if request.form("action")《》"耳语" then   
application("counter")=application("zj_1counter")+1   
counter=application("zj_1counter")   
'用户的动作处理   
  
select case request.FORM("action")   
case "说话"   
if request.FORM("whoto")="ALL" then   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 :《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
else   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》与《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》说《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
end if   
case "叫嚷"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》冲《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》大叫《/i》:《B》《font color=#0000aa》 "&usersays&"《/font》《/B》《BR》《BR》"   
case "亲亲"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》亲了亲《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》的脸颊《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
case "拥抱"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》轻轻的抱着《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
case "暴怒"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》朝《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》横眉竖目道《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
case "轻推"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》轻轻地推了推《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》的胳膊《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
case "傻笑"   
chats(counter)="《font color=blue》"&usertime&"《/font》 《font color=black》"&username&"《/font》 《i》傻兮兮的朝《font color=#00bb00》 "&request.FORM("whoto")&" 《/font》笑笑《/i》:《font color=#0000aa》 "&usersays&"《/font》《BR》《BR》"   
case "拳打"   
chats(counter)="《font color=blue》"&usertime&"

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: