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

📄 ms_publicfunction.asp

📁 本系统是一套开源WEB的网站管理系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
        	c=asc(mid(str,i,1))
            If c<0 Then c=c+65536
            If c>255 Then
                t=t+1
            End If
        Next
        strLength=t
    Else 
        strLength=len(str)
    End If
    If err.number<>0 Then err.clear
End function
Function filterKeyWord(str)
	if str="" or isNull(str) then
			filterKeyWord=""
		exit function
	end if
	dim word
	word=Split(killKeyWord,"|")
	For i=0 To Ubound(word)
		If i=0 Then
			restr=replace(str,word(i),"<font color=#FF0000>***</font>")
		Else
			restr=replace(restr_1,word(i),"<font color=#FF0000>***</font>")
		End If
		restr_1=restr
	Next
	filterKeyWord=restr
End Function
function userIsEnable(str)
	dim userKeyWord
	userIsEnable=true
	If str<>"" Then
		userKeyWord=split(killUserName,"|")
		For i=0 To Ubound(userKeyWord)
			If Instr(str,userKeyWord(i))>0 Then
				userIsEnable=false
			End If
		Next
	End If
End function
Function getIP() 
	Dim strIPAddr 
	If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then 
		strIPAddr = Request.ServerVariables("REMOTE_ADDR") 
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then 
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) 
	ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then 
		strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
	Else 
		strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
	End If 
	getIP = Replace(Trim(Mid(strIPAddr, 1, 30)), "'", "")
End Function
function getScriptName(type_)
	dim scriptName
		scriptName=Request.ServerVariables("SCRIPT_NAME")
	if type_=0 then
		getScriptName=mid(scriptName,instrRev(scriptName,"/")+1)
	else
		getScriptName=scriptName
	end if
End Function
Function showIp(ip)
If ip<>"" Then
	dim strIp,i,iptemp
	strIp=split(ip,".")
	i=0
	if ubound(strIP)=3 then
		do while i<viewIp
			if i=viewIP-1 then
			iptemp=iptemp&strIp(i)
			else
			iptemp=iptemp&strIp(i)&"."
			end if
			i=i+1
		loop
		i=0
		do while i<4-viewIp
			if viewip=0 and i=0 then
				iptemp=iptemp&"*"
			else
				iptemp=iptemp&".*"
			end if
			i=i+1
		loop
		showIp=iptemp
	else
		showIp=ip
	end if
End If
End Function
function cutstr(str,strlen)
if str<>"" then
	If len(replaceText(str))>strlen Then
		str=replace(str,"<P>","@p@")
		str=replace(str,"</P>","@1p@")
		str=replace(str,"<BR>","@BR@")
			str=left(replaceText(str),strlen)&"…"
			str=replace(str,"@p@","<p>")
			str=replace(str,"@1p@","</p>")
			str=replace(str,"@BR@","<br>")
	End If
end if
	cutstr=str
End function
function replaceText(str)
	dim regEx
	set regEx=New RegExp
	regEx.Pattern="<[^>]*>"
	regEx.Ignorecase=True
	regEx.Global=True
	replaceText=regEx.Replace(str,"")
End function
function cutTitle(str,strlen)
	If str="" Then
		cutTitle=""
		exit function
	End If
	dim l,t,c, i
	str=replace(replace(replace(replace(str,"&nbsp;"," "),"&quot;",chr(34)),"&gt;",">"),"&lt;","<")
	l=len(str)
	t=0
	For i=1 To l
		c=Abs(Asc(Mid(str,i,1)))
		If c>255 Then
			t=t+2
		Else
			t=t+1
		End If
		If t>=strlen Then
			cutTitle=left(str,i) & ".."
			exit For
		Else
			cutTitle=str
		End If
	Next
	cutTitle=replace(replace(replace(replace(cutTitle," ","&nbsp;"),chr(34),"&quot;"),">","&gt;"),"<","&lt;")
End function
Function JCode(byVal iStr)
If isnull(iStr) or isEmpty(iStr) Then
JCode=""
Exit function
End If
dim F,i,E
F=array("ゴ","ガ","ギ","グ","ゲ","ザ","ジ","ズ","ヅ","デ","ド","ポ","ベ","プ","ビ","パ","ヴ","ボ","ペ","ブ","ピ","バ","ヂ","ダ","ゾ","ゼ")
'E=array("Jn0;","Jn1;","Jn2;","Jn3;","Jn4;","Jn5;","Jn6;","Jn7;","Jn8;","Jn9;","Jn10;","Jn11;","Jn12;","Jn13;","Jn14;","Jn15;","Jn16;","Jn17;","Jn18;","Jn19;","Jn20;","Jn21;","Jn22;","Jn23;","Jn24;","Jn25;")
F=array(chr(-23116),chr(-23124),chr(-23122),chr(-23120),_
chr(-23118),chr(-23114),chr(-23112),chr(-23110),_
chr(-23099),chr(-23097),chr(-23095),chr(-23075),_
chr(-23079),chr(-23081),chr(-23085),chr(-23087),_
chr(-23052),chr(-23076),chr(-23078),chr(-23082),_
chr(-23084),chr(-23088),chr(-23102),chr(-23104),_
chr(-23106),chr(-23108))
JCode=iStr
For i=0 To 25
JCode=replace(JCode,F(i),"")
Next
End Function

Function CutStrs(str,strlen)
	Dim l,t,c
	l=len(str)
	t=0
	For i=1 To l
		c=Abs(Asc(Mid(str,i,1)))
		If c>255 Then
			t=t+2
		Else
			t=t+1
		End If
		If t>=strlen Then
			cutStr=left(str,i)&"..."
			Exit For
		Else
			cutStr=str
		End If
	Next
	CutStr=replace(cutStr,chr(10),"")
End Function
Function HTMLEncode(reString)
	Dim Str:Str=reString
	If Not IsNull(Str) Then
		Str = Replace(Str, "&", "&amp;")
		Str = Replace(Str, ">", "&gt;")
		Str = Replace(Str, "<", "&lt;")
		Str = Replace(Str, CHR(32),"&nbsp;")
	    Str = Replace(Str, CHR(9), "&nbsp;&nbsp;&nbsp;&nbsp;")
		Str = Replace(Str, CHR(34),"&quot;")
		Str = Replace(Str, CHR(39),"&#39;")
		Str = Replace(Str, CHR(13), "")
		Str = Replace(Str, CHR(10), "<br>")
		HTMLEncode = Str
	End If
End Function
Function ChkFormStr(ByVal str)
	Dim fString
	fString = str
	If IsNull(fString) Then
		ChkFormStr = ""
		Exit Function
	End If
	fString = Replace(fString, "'", "&#39;")
	fString = Replace(fString, Chr(34), "&quot;")
	fString = Replace(fString, Chr(13), "")
	fString = Replace(fString, Chr(10), "")
	fString = Replace(fString, Chr(9), "")
	fString = Replace(fString, ">", "&gt;")
	fString = Replace(fString, "<", "&lt;")
	fString = Replace(fString, "%", "%")
	ChkFormStr = Trim(JCode(fString))
End Function
Function chkColor(Str)
	If Not IsNull(Str) And Trim(Str)<>"" Then
		dim regEx
		set regEx=New RegExp
		regEx.Ignorecase=True
		regEx.Global=True
		regEx.Pattern="(#[A-Za-z0-9]{1,6})"
		retVal=regEx.Test(Str)
		If retVal Then
			chkColor=Str
		Else
			chkColor=""
		End If
		set regEx=nothing
	Else
		chkColor=""
	End if
End Function
Function chkSearchStr(str)
	FobWords = Array("&lt;","&gt;",">","<","=","#","*",";","|","%")
	For i = 0 To UBound(FobWords, 1)
		str=replace(str,FobWords(i),"")
	Next
	chkSearchStr=str
End Function
Function chkIsAvaStr(ByVal str)
		chkIsAvaStr = False
		On Error Resume Next
		If IsNull(str) Then Exit Function
		If Trim(str) = Empty Then Exit Function
		Dim ForbidStr, i
		ForbidStr = ":|=|%|&|$|#|@|+|-|*|/|\|<|>|;|,|^|" & Chr(32) & "|" & Chr(34) & "|" & Chr(39) & "|" & Chr(9)
		ForbidStr = Split(ForbidStr, "|")
		For i = 0 To UBound(ForbidStr)
			If InStr(1,str, ForbidStr(i),1) > 0 Then
				chkIsAvaStr = False
				Exit Function
			End If
		Next
		chkIsAvaStr = True
	End Function
Function bbimg(str,imgsize)
	str=replace(str,"<img","<img onload=""javascript:if(this.width>"& imgsize &"){this.width="&imgsize&";this.height=(this.height*"&imgsize&")/this.width;}"" onmousewheel=""return cgimg(this);"" ",1,-1,1)
	bbimg=str
End Function
'检查组件是否已经安装
Public Function chkObjInstalled(strClassString)
	On Error Resume Next
	ChkObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	If 0 = Err Then ChkObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function
'判断提交信息是否来自外部
Function chkIsOut()
	Dim server_v1,server_v2
	chkIsOut=False
	server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
	server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
	If Mid(server_v1,8,len(server_v2))=server_v2 Then chkIsOut=True 
End Function
'清除HTML代码 
Public Function filterHtml(Byval str)
	if not isnull(str) then
	dim re
	Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True
	re.Pattern="(\<.[^\<]*\>)"
	str=re.replace(str," ")
	re.Pattern="(\<\/[^\<]*\>)"
	str=re.replace(str,"")
	filterHtml=str
	Set re=Nothing
	End if
End Function
Sub maosin_getads(id)
dim sql,rs,strTemp
if id<>"" or isInteger(id) then
sql="select * from ms_ads where isOpen=1 and id="&id
set rs=conn.execute(sql)
if not rs.eof and not rs.bof then
	strTemp=maosin_adTemp(rs(8),rs(7))
	strTemp=replace(strTemp,"$adname$",rs(1))
	strTemp=replace(strTemp,"$adurl$",rs(2))
	strTemp=replace(strTemp,"$adpicurl$",rs(6))
	strTemp=replace(strTemp,"$width$",rs(4))
	strTemp=replace(strTemp,"$height$",rs(5))
	strTemp=replace(strTemp,"$adinfo$",rs(3))
	strTemp=replace(strTemp,"$adcode$",rs(9))
	response.write strTemp
end if
rs.close
set rs=nothing
end if
End Sub
'========================================================
'MaoSin CMS 1.1      Power by maosin.com
'Email: maosin@163.com , maosin@maosin.com
'Web: http://www.maosin.com  http://www.maosin.net
'Copyright (C) 2006 maosin.com All Rights Reserved.
'========================================================
%>

⌨️ 快捷键说明

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