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

📄 char.asp

📁 欢迎使用《雨点下载系统 2.0》! 本系统仅提供给个人网站免费使用
💻 ASP
字号:
<%sub error()%>
<br>
<table width=250 border=0 align="center" cellpadding=3 cellspacing=1 bgcolor="#666666">
  <tr align=center> 
    <td bgcolor=#EEEEEE><font color=#FF0000 style="font-size:14px"><strong>错 误 信 息</strong></font></td>
  </tr>
  <tr> 
    <td height="50" align="right" bgcolor=#FFFFFF> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="10%" align="center">&nbsp;</td>
          <td><font style="font-size:12px"><%=errmsg%></font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr align=center>
    <td bgcolor=#EEEEEE><a href=javascript:history.go(-1)><font style="font-size:12px">返回上一页</font></a></td>
  </tr>
</table>
<%end sub%>

<%sub ok()%>
<meta http-equiv="refresh" content="2; url=<%=gourl%>">
<br>
<table width=250 border=0 align="center" cellpadding=3 cellspacing=2 bgcolor="#666666">
  <tr> 
    <td height="50" align="center" bgcolor="#F6F6F6"><font color="#FF0000" style="font-size:14px"><strong><%=msg%></strong></font></td>
  </tr>
</table>
<%end sub%>

<%
Rem 过滤SQL非法字符
function chStr(str)
	if isnull(str) then
		chStr = ""
		exit function 
	end if
	chStr=replace(str,"'","''")
end function

Rem 判断数字是否整形
function isInteger(para)
       on error resume next
       dim str
       dim l,i
       if isNUll(para) then 
          isInteger=false
          exit function
       end if
       str=cstr(para)
       if trim(str)="" then
          isInteger=false
          exit function
       end if
       l=len(str)
       for i=1 to l
           if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
              isInteger=false 
              exit function
           end if
       next
       isInteger=true
       if err.number<>0 then err.clear
end function

Function chkemail(strEmailAddr)
    Dim re
    Set re = new RegExp
    re.pattern = "^[a-zA-Z][A-Za-z0-9_.-]+@[a-zA-Z0-9_]+?\.[a-zA-Z]{2,3}$"
    chkemail=re.Test(strEmailAddr)
end function

Function chkqq(qq)
    Dim re1
    Set re1 = new RegExp
    re1.IgnoreCase = false
    re1.global = false
    re1.Pattern = "[0-9]{4,9}$"
    chkqq = re1.Test(qq)
End Function

function DateToStr(dtDateTime)
	DateToStr = year(dtDateTime) & doublenum(Month(dtdateTime)) & doublenum(Day(dtdateTime)) & doublenum(Hour(dtdateTime)) & doublenum(Minute(dtdateTime)) & doublenum(Second(dtdateTime)) & ""
end function

function formatDT(dtDateTime,dtType)
	select case dtType
	'2003-02-25 09:40:50
	case "0" formatDT = year(dtDateTime) & "-" & doublenum(Month(dtdateTime)) & "-" & doublenum(Day(dtdateTime)) & " " & doublenum(Hour(dtdateTime)) & ":" & doublenum(Minute(dtdateTime)) & ":" & doublenum(Second(dtdateTime))
	'2003-02-25 09:40
	case "1" formatDT = year(dtDateTime) & "-" & doublenum(Month(dtdateTime)) & "-" & doublenum(Day(dtdateTime)) & " " & doublenum(Hour(dtdateTime)) & ":" & doublenum(Minute(dtdateTime))
	'2003-02-25
	case "2" formatDT = year(dtDateTime) & "-" & doublenum(Month(dtdateTime)) & "-" & doublenum(Day(dtdateTime))
	'2003-02
	case "3" formatDT = year(dtDateTime) & "-" & doublenum(Month(dtdateTime))
	'02-25
	case "4" formatDT = doublenum(Month(dtdateTime)) & "-" & doublenum(Day(dtdateTime))
	'09:40:50
	case "5" formatDT = doublenum(Hour(dtdateTime)) & ":" & doublenum(Minute(dtdateTime)) & ":" & doublenum(Second(dtdateTime))
	'09:40
	case "6" formatDT = doublenum(Hour(dtdateTime)) & ":" & doublenum(Minute(dtdateTime))
	end select
end function

function doublenum(fNum)
    if fNum > 9 then 
        doublenum = fNum 
    else 
        doublenum = "0" & fNum
    end if
end function

Rem ubb代码
function ChkBadWords(fString)
    dim BadWords,bwords,i
    bwords = split(BadWords, "|")
    for i = 0 to ubound(bwords)
        fString = Replace(fString, bwords(i), string(len(bwords(i)),"*"), 1,-1,1) 
    next
    ChkBadWords = fString
end function

function doCode(fString, fOTag, fCTag, fROTag, fRCTag)
    dim fOTagPos,fCTagPos
    fOTagPos = Instr(1, fString, fOTag, 1)
    fCTagPos = Instr(1, fString, fCTag, 1)
    while (fCTagPos > 0 and fOTagPos > 0)
        fString = replace(fString, fOTag, fROTag, 1, 1, 1)
        fString = replace(fString, fCTag, fRCTag, 1, 1, 1)
        fOTagPos = Instr(1, fString, fOTag, 1)
        fCTagPos = Instr(1, fString, fCTag, 1)
    wend
    doCode = fString
end function

function HTMLEncode(fString)
    fString = replace(fString, ">", "&gt;")
    fString = replace(fString, "<", "&lt;")
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10) & CHR(10), "</P><P>")
    fString = Replace(fString, CHR(10), "<BR>")
    HTMLEncode = fString
end function

function HTMLDecode(fString)
    fString = replace(fString, "&gt;", ">")
    fString = replace(fString, "&lt;", "<")
    fString = Replace(fString, "", CHR(13))
    fString = Replace(fString, "</P><P>", CHR(10) & CHR(10))
    fString = Replace(fString, "<BR>", CHR(10))
    HTMLDecode = fString
end function

function HTMLDecode1(fString)
    fString = replace(fString, "&gt;", ">")
    fString = replace(fString, "&lt;", "<")
    fString = Replace(fString, "", CHR(13))
    fString = Replace(fString, "</P><P>", CHR(10) & CHR(10))
    fString = Replace(fString, "<BR>", CHR(10))
    HTMLDecode1 = fString
end function

function UBBCode(strContent)
    'if strAllowHTML = 0 then
    strContent = HTMLEncode(strContent)
    'end if
	
	dim re
	set re = New RegExp	
	re.Global = True
	re.IgnoreCase = True
'	re.MultiLine = True

	strContent = replace(strContent , " " ,"&nbsp")
	strContent = replace(strContent , vbCrLf ,"<br>")
	
	re.Pattern = "\[url=(.[^\]]*)\](.[^\[]*)\[\/url]"
	strContent = re.Replace(strContent,"<a target=_blank href=$1>$2</a>")
	re.Pattern = "\[url](.[^\[]*)\[\/url]"
	strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
	re.Pattern = "\[email=(.[^\]]*)\](.[^\[]*)\[\/email]"
	strContent = re.Replace(strContent,"<a href=$1>$2</a>")
	re.Pattern = "\[email](.[^\[]*)\[\/email]"
	strContent = re.Replace(strContent,"<a href=mailto:$1>$1</a>")

	'if strAllowflash = 1 then
	re.Pattern = "\[FLASH](.[^\[]*)\[\/FLASH]"
	strContent = re.Replace(strContent,"<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=500 height=400><PARAM NAME=movie VALUE=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>")
	'end if
    re.Pattern="\[em(.[^\[]*)\]"
    strContent= re.Replace(strContent,"<img src=pic/em$1.gif border=0 align=middle>")
    re.Pattern="\[IMG](.[^\[]*)\[\/IMG]"
    strContent=re.Replace(strContent,"<IMG SRC=$1 border=0>")

    re.Pattern="\[HTML](.[^\[]*)\[\/HTML]"
    strContent=re.Replace(strContent,"<SPAN><IMG src=images/code.gif align=absBottom> HTML 代码片段如下:<BR><TEXTAREA style=""WIDTH: 94%; BACKGROUND-COLOR: #f7f7f7"" name=textfield rows=10>$1</TEXTAREA><BR><INPUT onclick=runEx() type=button value=运行此代码 name=Button> [Ctrl+A 全部选择   提示:你可先修改部分代码,再按运行]</SPAN><BR>")
 
    re.Pattern="\[COLOR=(.[^\]]*)\](.[^\[]*)\[\/COLOR]"
    strContent=re.Replace(strContent,"<font color=$1>$2</font>")
    re.Pattern="\[FACE=(.[^\]]*)\](.[^\[]*)\[\/FACE]"
    strContent=re.Replace(strContent,"<font face=$1>$2</font>")
    re.Pattern="\[ALIGN=(.[^\]]*)\](.[^\[]*)\[\/ALIGN]"
    strContent=re.Replace(strContent,"<div align=$1>$2</div>")
    re.Pattern="\[QUOTE](.[^\[]*)\[\/QUOTE]"
    strContent=re.Replace(strContent,"<BLOCKQUOTE><b>引用</b>:<HR size=1>$1<HR size=1></BLOCKQUOTE>")
    re.Pattern="\[FLY](.[^\[]*)\[\/FLY]"
    strContent=re.Replace(strContent,"<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>")
    re.Pattern="\[MOVE](.[^\[]*)\[\/MOVE]"
    strContent=re.Replace(strContent,"<MARQUEE scrollamount=3>$1</marquee>")
    re.Pattern="\[GLOW=(.[^\]]*),(.[^\]]*),(.[^\]]*)\](.[^\[]*)\[\/GLOW]"
    strContent=re.Replace(strContent,"<table width=$1 style=""filter:glow(color=$2, strength=$3)"">$4</table>")
    re.Pattern="\[SHADOW=(.[^\]]*),(.[^\]]*),(.[^\]]*)\](.[^\[]*)\[\/SHADOW]"
    strContent=re.Replace(strContent,"<table width=$1 style=""filter:shadow(color=$2, strength=$3)"">$4</table>")

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

    re.Pattern ="\[size=1](.[^\[]*)\[\/size]"
    strContent = re.Replace(strContent,"<font size=1>$1</font>")
    re.Pattern ="\[size=2](.[^\[]*)\[\/size]"
    strContent = re.Replace(strContent,"<font size=2>$1</font>")
    re.Pattern ="\[size=3](.[^\[]*)\[\/size]"
   	strContent = re.Replace(strContent,"<font size=3>$1</font>")
   	re.Pattern ="\[size=4](.[^\[]*)\[\/size]"
   	strContent = re.Replace(strContent,"<font size=4>$1</font>")

   	strContent = doCode(strContent, "[list]", "[/list]", "<ul>", "</ul>")
   	strContent = doCode(strContent, "[list=1]", "[/list]", "<ol type=1>", "</ol id=1>")
   	strContent = doCode(strContent, "[list=a]", "[/list]", "<ol type=a>", "</ol id=a>")
   	strContent = doCode(strContent, "[*]", "[/*]", "<li>", "</li>")
   	strContent = doCode(strContent, "[code]", "[/code]", "<pre id=code><font size=1 face=""Verdana, Arial"" id=code>", "</font id=code></pre id=code>")

   	strContent=ChkBadWords(strContent)
	UBBCode = strContent
end function

public function translate(sourceStr,fieldStr)
rem 处理逻辑表达式的转化问题
  dim  sourceList
  dim resultStr
  dim i,j
  if instr(sourceStr," ")>0 then 
     dim isOperator
     isOperator = true
     sourceList=split(sourceStr)
     '--------------------------------------------------------
     rem Response.Write "num:" & cstr(ubound(sourceList)) & "<br>"
     for i = 0 to ubound(sourceList)
        rem Response.Write i 
    Select Case ucase(sourceList(i))
    Case "AND","&","和","与"
        resultStr=resultStr & " and "
        isOperator = true
    Case "OR","|","或"
        resultStr=resultStr & " or "
        isOperator = true
    Case "NOT","!","非","!","!"
        resultStr=resultStr & " not "
        isOperator = true
    Case "(","(","("
        resultStr=resultStr & " ( "
        isOperator = true
    Case ")",")",")"
        resultStr=resultStr & " ) "
        isOperator = true
    Case Else
        if sourceList(i)<>"" then
            if not isOperator then resultStr=resultStr & " and "
            if inStr(sourceList(i),"%") > 0 then
                resultStr=resultStr&" "&fieldStr& " like '" & replace(sourceList(i),"'","''") & "' "
            else
                resultStr=resultStr&" "&fieldStr& " like '%" & replace(sourceList(i),"'","''") & "%' "
            end if
                isOperator=false
        End if    
    End Select
        rem Response.write resultStr+"<br>"
     next 
     translate=resultStr
  else '单条件
     if inStr(sourcestr,"%") > 0 then
         translate=" " & fieldStr & " like '" & replace(sourceStr,"'","''") &"' "
     else
    translate=" " & fieldStr & " like '%" & replace(sourceStr,"'","''") &"%' "
     End if
     '前后各加一个空格,免得连sql时忘了加,而出错。
  end if  
end function

Rem 判断E-mail地址
function IsValidEmail(email)
	dim names, name, i, c
	'Check for valid syntax in an email address.
	IsValidEmail = true
	names = Split(email, "@")
	if UBound(names) <> 1 then
   		IsValidEmail = false
   		exit function
	end if
	for each name in names
   		if Len(name) <= 0 then
     		IsValidEmail = false
     		exit function
   		end if
   		for i = 1 to Len(name)
     		c = Lcase(Mid(name, i, 1))
     		if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
       			IsValidEmail = false
       			exit function
     		end if
   		next
   		if Left(name, 1) = "." or Right(name, 1) = "." then
      		IsValidEmail = false
      		exit function
   		end if
	next
	if InStr(names(1), ".") <= 0 then
   		IsValidEmail = false
   		exit function
	end if
	i = Len(names(1)) - InStrRev(names(1), ".")
	if i <> 2 and i <> 3 then
   		IsValidEmail = false
   		exit function
	end if
	if InStr(email, "..") > 0 then
   		IsValidEmail = false
	end if
end function

function nohtml(str)
	dim re
	Set re=new RegExp
	re.IgnoreCase =true
	re.Global=True
	re.Pattern="(\<.*?\>)"
	str=re.replace(str,"")
	re.Pattern="(\<\/.*?\>)"
	str=re.replace(str,"")
	nohtml=str
end function

function strlen(str)
  dim p_len,xx
  p_len=0
  strlen=0
  if trim(str)<>"" then
    p_len=len(trim(str))
	for xx=1 to p_len
	  if asc(mid(str,xx,1))<0 then
	    strlen=int(strlen)+2
      else
	    strlen=int(strlen)+1
	  end if
	next
  end if
end function

function strvalue(str,lennum)
	dim p_num
	dim i,x
	if strlen(str)<=lennum then
		strvalue=str
	else
		p_num=0
		x=0
		do while not p_num>lennum-2
			x=x+1
			if asc(mid(str,x,1))<0 then
				p_num=int(p_num)+2
			else
				p_num=int(p_num)+1
			end if
		loop
		strvalue=left(trim(str),x)&".."
	end if
end function

function killchar(str)
	if SiteSetting(5)<>"" then
		dim badchar,i
		badchar=Split(SiteSetting(5),"|")
		for i=0 to UBound(badchar)
			str=replace(str,badchar(i),"***")
		next
		killchar=HTMLEncode(replace(str,VBCrLf," "))
	else
		killchar=HTMLEncode(replace(str,VBCrLf," "))
	end if	
end function
%>

⌨️ 快捷键说明

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