📄 chkinput.inc
字号:
<%
Rem ==========通用函数=========
'简单加密函数
function encrypt(ecode)
Dim texts
dim i
for i=1 to len(ecode)
texts=texts & chr(asc(mid(ecode,i,1))+i)
next
encrypt = texts
end function
'简单对应解密函数
function decrypt(dcode)
Rem ???¨2¨¢???DD?a?¨1
dim texts
dim i
for i=1 to len(dcode)
texts=texts & chr(asc(mid(dcode,i,1))-i)
next
decrypt=texts
end function
'加密函数,该函数没有对应解密函数
function mistake(preString)
Dim texts
Dim seed
Dim i,length
prestring = trim(preString)
length = len(preString)
seed = length
Randomize(length)
texts = ""
for i = 1 to length
seed = int(94*rnd(-asc(mid(preString,i,1))-seed*asc(right(prestring,1)))+32)
texts = texts & chr(seed) & chr(int(94*rnd(-seed)+32))
next
mistake = texts
end function
'计算字符串的长度,如果包括中文,则每个中文字长度返回为2
function StrLen(str)
ON ERROR RESUME NEXT
dim WINNT_CHINESE
WINNT_CHINESE = (len("中文")=2)
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLen=t
else
strLen=len(str)
end if
if err.number<>0 then err.clear
end function
'从字符串中截取给定长度字串,如果过长,则加上"..."
function CutStr(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
'显示文本,当文本中有回车键时自动添加<br>
sub ShowBody(Str)
dim dist
dim i
for i = 1 to len(str)
if mid(str,i,1)<>chr(13) then
dist=dist+mid(str,i,1)
else
response.write dist
response.write "<BR>"+chr(13)+chr(10)
dist=""
end if
next
response.write dist
end sub
'检查是否有单引号
function HasSingleQuotes(str)
dim i
HasSingleQuotes=true
str=trim(str)
for i=1 to len(str)
if mid(str,i,1)="'" then
HasSingleQuotes=false
exit function
end if
next
end function
'检查是否有空格和回车键,如果有,则替换成html显示符
function CheckInfo(str)
dim i
CheckInfo=""
if not isnull(str) then
for i=1 to len(str)
if mid(str,i,1)=" " then
CheckInfo=CheckInfo&" "
elseif mid(str,i,1)=chr(13) and mid(str,i+1,1)=chr(10) then
CheckInfo=CheckInfo&"<br>"
i=i+1
else
CheckInfo=CheckInfo&mid(str,i,1)
end if
next
end if
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -