<%@ LANGUAGE=VBScript codepage ="936" %>
<!--#include file="sjfunc.asp"-->
<%'千里传音
Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl ="No-Cache"
cwjh_name=Session("cwjh_name")
cwjh_jhdj=Session("cwjh_jhdj")
nowinroom=session("nowinroom")
if Instr(LCase(Application("cwjh_useronlinename"&nowinroom)),LCase(" "&cwjh_name&" "))=0 then 
	Session("cwjh_inthechat")="0" 
	Response.Redirect "chaterr.asp?id=001" 
end if 
if cwjh_jhdj<jhdj_qlcy then
	call mess("提示：使用千里传音需要["&jhdj_qlcy&"]级才可以！",1)
end if
towho=Trim(Request.Form("towho"))
towhoway=Request.Form("towhoway")
saycolor=Request.Form("saycolor")
addwordcolor=Request.Form("addwordcolor")
addsays=Request.Form("addsays")
says=Trim(Request.Form("sy"))
'对暂离开、点哑穴判断
call dianzan(towho)
act=0
if len(says)>150 then says=Left(says,150)
says=lcase(says)
says=Replace(says,"&amp;","&")
'对系统禁止字符处理
if cwjh_grade<9 then
	says=bdsays(says)
end if
act=1
towhoway=0
i=instr(says,"$")
fnn1=mid(says,i+1)
says="<font color=" & saycolor & ">"+titl(mid(says,i+1))+"</font>"
'call chatsay("千里",towhoway,towho,saycolor,addwordcolor,addsays,says)
function titl(fn1)
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("cwjh_usermdb")
rs.open "select 内力,名单头像 FROM 用户 WHERE 姓名='" & cwjh_name &"'",conn,2,2
tx=rs("名单头像")
if rs("内力")<1000  then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	call mess("提示：需要内力1000、好好练几天吧！",1)
end if
conn.execute "update 用户 set 内力=内力-1000 where 姓名='" & cwjh_name &"'"
says="<bgsound src=wav/anqi1.wav loop=2><marquee border='1' onmouseover=this.stop(); onmouseout=this.start();><img src="&tx &">[千里传音]" & fn1 & "  (##)" & "</marquee>"
cwjh_roominfo=split(Application("cwjh_room"),";")
chatroomnum=ubound(cwjh_roominfo)-1
says=replace(says,chr(39),"\'")
says=replace(says,chr(34),"\"&chr(34))
zj="<a href=javascript:parent.sw(\'[" & cwjh_name & "]\'); target=f2><font color="&addwordcolor&">"& cwjh_name & "</font></a>"
br="<a href=javascript:parent.sw(\'[" & towho & "]\'); target=f2><font color="&addwordcolor&">"& towho & "</font></a>"
says=Replace(says,"##",zj)
says=Replace(says,"%%",br)
says=Replace(says,"$$redb","<font color=red><b>")
says=Replace(says,"$$blueb","<font color=blue><b>")
says=Replace(says,"$$yellowb","<font color=yellow><b>")
says=Replace(says,"$$greenb","<font color=green><b>")
says=Replace(says,"$$b","</b></font>")
says=Replace(says,"$$red","<font color=red>")
says=Replace(says,"$$blue","<font color=blue>")
says=Replace(says,"$$yellow","<font color=yellow>")
says=Replace(says,"$$green","<font color=green>")
says=Replace(says,"$$","</font>")
for nowinroom=0 to chatroomnum
	saystr="<script>parent.sh("& chr(39) & addwordcolor & chr(39) &","& chr(39) & saycolor & chr(39) &","& chr(39) & act & chr(39) &","& chr(39) & cwjh_name & chr(39) &","& chr(39) & addsays & chr(39) &","& chr(39) & towho & chr(39) &"," & chr(39) & says & chr(39) &"," & towhoway &  ","& nowinroom & ");<"&"/script>"
	addmsg saystr
next
rs.close
set rs=nothing	
conn.close
set conn=nothing
end function
%>