⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.asp

📁 Ajax留言本源代码 网上找到的一个源码,希望做网站的能用上.
💻 ASP
📖 第 1 页 / 共 2 页
字号:
             GetInfo=GetInfo&rs(N)&SplitStr1
             rs.movenext
          loop
       else
          do while not rs.eof
             N=Split(N,",")
             for i=0 to Ubound(N)
                 GetInfo=GetInfo&rs(N(i))&SplitStr
             next
             GetInfo=left(GetInfo,len(GetInfo)-Len(SplitStr))&SplitStr1
             rs.movenext
          loop
       end if
       GetInfo=left(GetInfo,len(GetInfo)-Len(SplitStr1))    
    end if
    rs.close
    Set rs=nothing
End Function

Function Intercept(str,num,rightstr)
    dim i,p_str,p_num,p_len
    p_str = ""
    p_num = 0                
    if trim(str) <> "" then
       p_len = len(str)
       for i = 1 to p_len
           if asc(mid(str,i,1)) > 255 or asc(mid(str,i,1)) < 0 then
              p_num = p_num + 2
           else
              p_num = p_num + 1
           end if        
           if p_num > num then 
              p_str = Left(str,i-1)&rightstr 
              exit for
           else
              p_str = str
           end if
       next
    end if
    Intercept=p_str
End Function

Function GetTotalSize(GetLocal,GetType)
	Dim FSO
	Set FSO=Server.CreateObject("Scripting.FileSystemObject")
	IF Err<>0 Then
		Err.Clear
		GetTotalSize="服务器关闭FSO,查看占用空间失败"
	Else
		Dim SiteFolder
		IF GetType="Folder" Then
			Set SiteFolder=FSO.GetFolder(GetLocal) 
		Else
			Set SiteFolder=FSO.GetFile(GetLocal) 
		End IF
		GetTotalSize=SiteFolder.Size
		IF GetTotalSize>1024*1024 Then
		GetTotalSize=GetTotalSize/1024/1024
		IF inStr(GetTotalSize,".") Then GetTotalSize = Left(GetTotalSize,inStr(GetTotalSize,".")+3)
			GetTotalSize=GetTotalSize&" MB"
		Else
			GetTotalSize=Fix(GetTotalSize/1024)&" KB"
		End IF
		Set SiteFolder=Nothing
	End IF
	Set FSO=Nothing
End Function

Function DeleteFiles(FilePath)
    Dim FSO
    Set FSO=Server.CreateObject("Scripting.FileSystemObject")
    IF FSO.FileExists(FilePath) Then
		FSO.DeleteFile FilePath,True
		DeleteFiles = 1
    Else
		DeleteFiles = 0
    End IF
    Set FSO = Nothing
End Function

'UBB代码转换
Function LeoUbb(strcontent)
	dim re,tempcodes,tempcode,i,searcharray,replacearray
	Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True

	strcontent=Replace(strcontent,"file:","file :")
	strcontent=Replace(strcontent,"files:","files :")
	strcontent=Replace(strcontent,"script:","script :")
	strcontent=Replace(strcontent,"js:","js :")
    '附件
    	're.pattern="\[Attach\]([0-9]*)\[\/Attach\]"
           'strcontent=re.replace(strcontent,RegExp.$1)
    '图片UBB
	re.pattern="\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]"
	strcontent=re.replace(strcontent,"<a onfocus=""this.blur()"" href=""$1://$2"" target=new><img src=""$1://$2"" border=""0"" alt=""按此在新窗口浏览图片"" onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>")
	'链接UBB
	re.pattern="(\[url\])(.[^\[]*)(\[url\])"
	strcontent= re.replace(strcontent,"<a href=""$2"" target=""new"">$2</a>")
	re.pattern="\[url=(.[^\[]*)\]"
	strcontent= re.replace(strcontent,"<a href=""$1"" target=""new"">")
	'邮箱UBB
	re.pattern="(\[email\])(.*?)(\[\/email\])"
	strcontent= re.replace(strcontent,"<img align=""absmiddle"" ""src=image/email1.gif""><a href=""mailto:$2"">$2</a>")
	re.pattern="\[email=(.[^\[]*)\]"
	strcontent= re.replace(strcontent,"<img align=""absmiddle"" src=""image/email1.gif""><a href=""mailto:$1"" target=""new"">")
	'QQ号码UBB
	re.pattern="\[qq=([1-9]*)\]([1-9]*)\[\/qq\]"
	strcontent= re.replace(strcontent,"<a target=""new"" href=""tencent://message/?uin=$2&Site=WwW.17Show.Net&Menu=yes"">QQ:$2</a>")
    '颜色UBB
	re.pattern="\[color=(.[^\[]*)\]"
	strcontent=re.replace(strcontent,"<font color=""$1"">")
	'文字字体UBB
	re.pattern="\[font=(.[^\[]*)\]"
	strcontent=re.replace(strcontent,"<font face=""$1"">")
	'文字大小UBB
	re.pattern="\[size=([1-7])\]"
	strcontent=re.replace(strcontent,"<font size=""$1"">")
	'文字对齐方式UBB
	re.pattern="\[align=(center|left|right)\]"
	strcontent=re.replace(strcontent,"<div align=""$1"">")
	'表格UBB
	re.pattern="\[table=(.[^\[]*)\]"
	strcontent=re.replace(strcontent,"<table width=""$1"">")

    'FLASH动画UBB
	re.pattern="(\[flash\])(http://.[^\[]*(.swf))(\[\/flash\])"
	strcontent= re.replace(strcontent,"<a href=""$2"" target=""new""><img src=""image/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该flash动画!"" height=""16"" width=""16"">[全屏欣赏]</a><br><center><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=""300"" height=""200""><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"" width=""300"" height=""200"">$2</embed></object></center>")
    
	re.pattern="(\[flash=*([0-9]*),*([0-9]*)\])(http://.[^\[]*(.swf))(\[\/flash\])"
	strcontent= re.replace(strcontent,"<a href=""$4"" target=""new""><img src=""image/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该flash动画!"" height=""16"" width=""16"">[全屏欣赏]</a><br><center><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></center>")

    'MEDIA PLAY播放UBB
	re.pattern="\[wmv\](.[^\[]*)\[\/wmv]"
	strcontent=re.replace(strcontent,"<object align=""middle"" classid=""clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"" class=""object"" id=""mediaplayer"" width=""300"" height=""200"" ><param name=""showstatusbar"" value=""-1""><param name=""filename"" value=""$1""><embed type=""application/x-oleobject"" codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701"" flename=""mp"" src=""$1""  width=""300"" height=""200""></embed></object>")

	re.pattern="\[wmv=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/wmv]"
	strcontent=re.replace(strcontent,"<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>")

    
	'REALPLAY 播放UBB
    re.pattern="\[rm\](.[^\[]*)\[\/rm]"
	strcontent=re.replace(strcontent,"<object classid=""clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa"" class=""object"" id=""raocx"" width=""300"" height=""200""><param name=""src"" value=""$1""><param name=""console"" value=""clip1""><param name=""controls"" value=""imagewindow""><param name=""autostart"" value=""true""></object><br><object classid=""clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa"" height=""32"" id=""video2"" width=""300""><param name=""src"" value=""$1""><param name=""autostart"" value=""-1""><param name=""controls"" value=""controlpanel""><param name=""console"" value=""clip1""></object>")

	re.pattern="\[rm=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/rm]"
	strcontent=re.replace(strcontent,"<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=""true""></object><br><object classid=""clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa"" height=""32"" id=""video2"" width=""$1""><param name=""src"" value=""$3""><param name=""autostart"" value=""-1""><param name=""controls"" value=""controlpanel""><param name=""console"" value=""clip1""></object>")

    strcontent=replace(strcontent,vbcrlf,"<BR/>")
	re.pattern="\[code\]((.|\n)*?)\[\/code\]"
	Set tempcodes=re.Execute(strcontent)
	For i=0 To tempcodes.count-1
	  re.pattern="<BR/>"
	  tempcode=Replace(tempcodes(i),"<BR/>",vbcrlf)
	  strcontent=replace(strcontent,tempcodes(i),tempcode)
	next

    searcharray=Array("[/url]","[/email]","[/color]", "[/size]", "[/font]", "[/align]", "[b]", "[/b]","[i]", "[/i]", "[u]", "[/u]", "[list]", "[list=1]", "[list=a]","[list=A]", "[*]", "[/list]", "[indent]", "[/indent]","[code]","[/code]","[quote]","[/quote]","[table]","[tr]","[td]","[/tr]","[/td]","[/table]")
	replacearray=Array("</a>","</a>","</font>", "</font>", "</font>", "</div>", "<b>", "</b>", "<i>","</i>", "<u>", "</u>", "<ul>", "<ol type=1>", "<ol type=a>","<ol type=A>", "<li>", "</ul></ol>", "<blockquote>", "</blockquote>","<div><textarea name=""Codes"" id=""Codes"" rows=""12"" cols=""65"">","</textarea><br/><input type=""button"" value=""运行代码"" onclick=""RunCode(Codes)""> <input type=""button"" value=""复制代码"" onclick=""CopyCode(Codes)""> <input type=""button"" value=""另存代码"" onclick=""SaveCode(Codes)""> &nbsp;提示:您可以先修改部分代码再运行</div>","<font color=""#FF0000"">以下方框内为引用内容</font>:<br/><div style=""background:#FFDD20;width:100%;height:120%;border:1px solid #FF8800;padding:4px;"">","</div>","<table>","<tr>","<td>","</tr>","</td>","</table>")
	For i=0 To UBound(searcharray)
		strcontent=replace(strcontent,searcharray(i),replacearray(i))
	next
	set re=Nothing
	LeoUbb=strcontent
End Function


%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -