<%
dim Chat,CallRoom
set rs_xkme=server.createobject("adodb.recordset")
rs_xkme.open "select top 1 [Chattxt] from Chat where [id]=1 ",conn,1,2
if not (rs_xkme.eof and rs_xkme.bof) then
Chat     = rs_xkme("Chattxt")
end if
rs_xkme.close
set rs_xkme=nothing



  if Chat<>"" then
    Chat = Replace(Chat,"\","")
    Chat = Replace(Chat,"＼","")
    Chat = Replace(Chat,chr(13),"")
    Chat = Replace(Chat,chr(10),"")

    if InStr(Chat,",") then
      Chattxt=split(Chat,",")
      CallRoom= "<a href=""/bbs/chat/chatroom.asp?ID=1&amp;sid="&sid &""" >聊</a>:" & Replace(xkme_chatusb(Chattxt(0)),"chatsend.asp","/bbs/chat/chatroom.asp") &"<br/>"&chr(13)
    end if
  end if

function xkme_chatusb(str)
	str=trim(str)
	if IsNull(str) then exit function
	str = replace(str, "sid=@@sid@@", "TM="&TM&"&amp;Pa="&Pa&"&amp;sid="&sid&"")
Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True
	re.pattern="(\(img)\)(.{5,}?)\(/img\)"
	str= re.Replace(str,"<img src=""$2"" alt='.'/>")
	re.pattern="(\[img\])(.[^\[]*)(\[\/img\])"
	str= re.Replace(str,"<img src=""$2"" alt='.'/>")
	re.pattern="(\(URL\))(.[^\(]*)(\(\/URL\))"
	str= re.Replace(str,"<a href=""$2"" >$2</a>")
	re.pattern="(\(URL=(.[^\(]*)\))(.[^\(]*)(\(\/URL\))"
	str= re.Replace(str,"<a href=""$2"" >$3</a>")
	re.pattern="(\[url\])(.[^\[]*)(\[\/url\])"
	str= re.Replace(str,"<a href=""$2"" >$2</a>")
	re.pattern="(\[url=(.[^\]]*)\])(.[^\[]*)(\[\/url\])"
	str= re.Replace(str,"<a href=""$2"" >$3</a>")
	re.pattern="(\(c\))(.[^\[]*)(\(\/c\))"
	str= re.Replace(str,"<a href=""wtai://wp/mc;$2"" >$2</a>")
	re.pattern="(\(c=(.[^\]]*)\))(.[^\[]*)(\(\/c\))"
	str= re.Replace(str,"<a href=""wtai://wp/mc;$2"" >$3</a>")
	re.pattern="(\(u\))(.[^\[]*)(\(\/u\))"
	str= re.Replace(str,"<u>$2</u>")
	re.pattern="(\(b\))(.[^\[]*)(\(\/b\))"
	str= re.Replace(str,"<b>$2</b>")
	re.pattern="(\(i\))(.[^\[]*)(\(\/i\))"
	str= re.Replace(str,"<i>$2</i>")
        re.Pattern="(\\\\)"
	str= re.Replace(str,"<br/>")
	set re=nothing
	xkme_chatusb=str
end function
%>
     