<%
function UBB(Content)
	Content = HTMLcode(Content)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
	
	re.Pattern="(javascript)"
	Content=re.Replace(Content,"&#106avascript")
	re.Pattern="(jscript:)"
	Content=re.Replace(Content,"&#106script:")
	re.Pattern="(js:)"
	Content=re.Replace(Content,"&#106s:")
	re.Pattern="(value)"
	Content=re.Replace(Content,"&#118alue")
	re.Pattern="(about:)"
	Content=re.Replace(Content,"about&#58")
	re.Pattern="(file:)"
	Content=re.Replace(Content,"file&#58")
	re.Pattern="(document.cookie)"
	Content=re.Replace(Content,"documents&#46cookie")
	re.Pattern="(vbscript:)"
	Content=re.Replace(Content,"&#118bscript:")
	re.Pattern="(vbs:)"
	Content=re.Replace(Content,"&#118bs:")
	re.Pattern="(on(mouse|exit|error|click|key))"
	Content=re.Replace(Content,"&#111n$2")

	re.Pattern = "\[IMG\](http|https|ftp)://(.[^\[]*)\[\/IMG\]"
	Content = re.Replace(Content,"相关图片:<br><A onfocus=""this.blur()"" href=""$1://$2"" TARGET=_blank><IMG SRC=""$1://$2"" border=""0"" onload=""javascript:if(this.width>screen.width-380){this.width=screen.width-380;}"" onmousewheel=""return img(this)""></A><br>")

	're.Pattern="\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]"
	'Content=re.Replace(Content,"<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>")

	're.Pattern="\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]"
	'Content=re.Replace(Content,"<object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=$1 height=$2 ><param name=ShowStatusBar value=-1><param name=Filename value=$3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>")

	're.Pattern="\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]"
	'Content=re.Replace(Content,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2><PARAM NAME=SRC VALUE=$3><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=-1></OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=60 id=video2 width=$1><PARAM NAME=SRC VALUE=$3><PARAM NAME=_ExtentX VALUE=10054><PARAM NAME=_ExtentY VALUE=1588><PARAM NAME=AUTOSTART VALUE=-1><PARAM NAME=CONTROLS value=ControlPanel,StatusBar><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>")

	re.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])"
	Content= re.Replace(Content,"<IMG SRC=Images/File/swf.gif border=0><A TARGET=_blank HREF=$2>[全屏欣赏该FLASH]</A>")

	're.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])"
	'Content= re.Replace(Content,"<IMG SRC=Images/File/swf.gif border=0><a href=$4 TARGET=_blank>[全屏欣赏FLASH]</a><br><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME=movie VALUE=$2><PARAM NAME=quality VALUE=high><embed src=$2 quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'>$2</embed></OBJECT>")

	're.Pattern="(\[FLASH=*([0-9]*),*([0-9]*)\])(.[^\[]*)(\[\/FLASH\])"
	'Content= re.Replace(Content,"<IMG SRC=Images/File/swf.gif border=0><a href=$4 TARGET=_blank>[全屏欣赏FLASH]</a><br><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=$2 height=$3><PARAM NAME=movie VALUE=$4><PARAM NAME=quality VALUE=high><embed src=$4 quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$2 height=$3>$4</embed></OBJECT>")

	re.Pattern="(\[SOUND\])(.[^\[]*)(\[\/SOUND\])" 
	Content=re.Replace(Content,"<IMG SRC=Images/File/mid.gif border=0><a href=$2 target=_blank>[附背景音乐]</a><bgsound src=$2 loop='-1'>")

	re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])"
	Content= re.Replace(Content,"<A HREF=$2 TARGET=_blank>$2</A>")

	re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
	Content= re.Replace(Content,"<A HREF=$2 TARGET=_blank>$3</A>")
	
	re.Pattern="(\[EMAIL\])(\S+\@.[^\[]*)(\[\/EMAIL\])"
	Content= re.Replace(Content,"<A HREF=mailto:$2>$2</A>")

	re.Pattern="(\[EMAIL=(\S+\@.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])"
	Content= re.Replace(Content,"<A target=_blank HREF=mailto:$2>$3</A>")

	re.Pattern = "^((http|https|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+([^<>""])+)"
	Content = re.Replace(Content,"<a target=_blank href=$1>$1</a>")

	re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+)$([^\[]*)"
	Content = re.Replace(Content,"<a target=_blank href=$1>$1</a>")

	re.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(\/\/|\\\\)[A-Za-z0-9\./=\?%\-&_~`@[\]\':+!]+)"
	Content = re.Replace(Content,"$1<a target=_blank href=$2>$2</a>")

	re.Pattern = "(^[(http://|http:\\)])((www|cn)[.](\w)+[.]{1,}(net|com|cn|org|cc)(((\/[\~]*|\\[\~]*)(\w)+)|[.](\w)+)*(((([?](\w)+){1}[=]*))*((\w)+){1}([\&](\w)+[\=](\w)+)*)*)"
	Content = re.Replace(Content,"<a target=_blank href=http://$2>$2</a>")

	're.Pattern = "([^(=)])((\w)+[@]{1}((\w)+[.]){1,3}(\w)+)"
	'Content = re.Replace(Content,"<img align=absmiddle src=Images/File/mail.gif border=0><a target=_blank href='mailto:$2'>$2</a>")

	re.Pattern="\[HMTL\](.[^\[]*)\[\/HTML\]"
	Content=re.Replace(Content,"<table width='90%' border='0' cellspacing='0' cellpadding=6><TR><TD width='100%' bgColor='#f3f3f3' class='INDEX_TMALL'>[HTML]---------------------------------------------------<br>$1<br>-----------------------------------------------------[/HTML]</td></tr></table><br>")

	re.Pattern="\[CODE\](.[^\[]*)\[\/CODE\]"
	Content=re.Replace(Content,"<table width='90%' border='0' cellspacing='0' cellpadding=6><TR><TD width='100%' bgColor='#f3f3f3' class='INDEX_TMALL'>[CODE]---------------------------------------------------<br>$1<br>-----------------------------------------------------[/CODE]</td></tr></table><br>")

	re.Pattern="\[FACE=(.[^\[]*)\](.[^\[]*)\[\/FACE\]"
	Content=re.Replace(Content,"<FONT FACE=$1>$2</FONT>")

	re.Pattern="\[COLOR=(.[^\[]*)\](.[^\[]*)\[\/COLOR\]"
	Content=re.Replace(Content,"<FONT COLOR=$1>$2</FONT>")

	re.Pattern="\[ALIGN=(center|left|right)\](.[^\[]*)\[\/ALIGN\]"
	Content=re.Replace(Content,"<DIV ALIGN=$1>$2</DIV>")

	re.Pattern="\[QUOTE\](.*)\[\/QUOTE\]"
	Content=re.Replace(Content,"<table width='90%' border='0' cellspacing='0' cellpadding=6><TR><TD width='100%' bgColor='#f3f3f3' class='INDEX_TMALL'><font color=#006600 size=2>以下是引用文章</font>---------------------------------------------------<br>$1<br>----------------------------------------------------------------</td></tr></table><br>")

	re.Pattern="\[B\](.[^\[]*)(\[\/B\])"
	Content=re.Replace(Content,"<B>$1</B>")

	re.Pattern="\[I\](.[^\[]*)\[\/I\]"
	Content=re.Replace(Content,"<I>$1</I>")

	re.Pattern="\[U\](.[^\[]*)(\[\/U\])"
	Content=re.Replace(Content,"<U>$1</U>")

	re.Pattern="\[SIZE=([1-5])\](.[^\[]*)\[\/SIZE\]"
	Content=re.Replace(Content,"<FONT SIZE=$1>$2</FONT>")
	Content=replace(Content,"<I></I>","")

	if instr(lcase(Content),"[FACE")>0 then
		for FaceCount = 0 to 29
		Content=replace(lcase(Content),"[FACE"&FaceCount&"]","<img src=Face/FACE"&FaceCount&".gif border=0 align=middle>")
		next
	end if
	re.Pattern="(\[FACE(.[^\[]*)\])"
	Content= re.Replace(Content,"<img src=Face/FACE$2.gif border=0 align=middle>")

set re=Nothing
UBB=Content
end function

Function FilterJS(v)
	if not isnull(v) then
		dim t
		dim re
		dim reContent
		Set re=new RegExp
		re.IgnoreCase =true
		re.Global=True
		re.Pattern="(javascript)"
		t=re.Replace(v,"&#106avascript")
		re.Pattern="(jscript:)"
		t=re.Replace(t,"&#106script:")
		re.Pattern="(js:)"
		t=re.Replace(t,"&#106s:")
		re.Pattern="(value)"
		t=re.Replace(t,"&#118alue")
		re.Pattern="(about:)"
		t=re.Replace(t,"about&#58")
		re.Pattern="(file:)"
		t=re.Replace(t,"file&#58")
		re.Pattern="(document.cookie)"
		t=re.Replace(t,"documents&#46cookie")
		re.Pattern="(vbscript:)"
		t=re.Replace(t,"&#118bscript:")
		re.Pattern="(vbs:)"
		t=re.Replace(t,"&#118bs:")
		re.Pattern="(on(mouse|exit|error|click|key))"
		t=re.Replace(t,"&#111n$2")
		re.Pattern="(&#)"
		t=re.Replace(t,"＆#")
		FilterJS=t
		set re=nothing
	end if
End Function

function HTMLcode(Content)
	if not isnull(Content) then
		Content = Replace(Content, "  ","&nbsp;&nbsp;")
		Content = Replace(Content, ">", "&gt;")
		Content = Replace(Content, "<", "&lt;")
		Content = Replace(Content, "\", "\\")
		Content = Replace(Content, CHR(34), "&quot;")
		Content = Replace(Content, CHR(39), "&#39;")
		Content = Replace(Content, CHR(13), "")
		Content = Replace(Content, CHR(10) & CHR(10), "</P><P> ")
		Content = Replace(Content, CHR(10), "<BR>")
		HTMLcode = Content
	end if
end function
%>

<%
Function PostString(Content)
	if not isnull(Content) then
		Content = Replace(Content, "'","''")
		PostString = Content
	end if
End Function

Function ShowString(Content)
	if not isnull(Content) then
		Content = Replace(Content, "  ","&nbsp;&nbsp;")
		Content = Replace(Content, ">", "&gt;")
		Content = Replace(Content, "<", "&lt;")
		Content = Replace(Content, CHR(13), "")
		Content = Replace(Content, CHR(10), "<BR>")
		Content = Replace(Content, CHR(34), "&quot;")
		Content = Replace(Content, CHR(39), "&#39;")
		ShowString = Content
	end if
End Function
%>

<%
Function IpArray(IpStr)
	If not isNull(IpStr) then
        T = 0
	IpX=""
	IpFB = Split(IpStr, ".",4)
		For T = 0 to 2
		IpX = IpX&IpFB(T)&"."
		Next
	IpStr = IpX&"*"
	End if
End Function
%>