📄 config.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<!--#include file="HtmlConfig.asp"-->
<%
response.Expires=-999
Session.Timeout=200
'变量定义
dim rs,sqlstr,id,rs2
dim page_size,page_now,i,j,list_page_size
'---------------------
'定义常量
'---------------------
Page_Size_All=14
set rs=server.createobject("adodb.recordset")
set rst=server.createobject("adodb.recordset")
'---------------------
'获取ip,穿透简单ip代理
'---------------------
LoadIp = request.ServerVariables("HTTP_X_FORWARDED_FOR") '如果用户用了代理,那么这个值就不会为空
if LoadIp = "" then
LoadIp = request.ServerVariables("REMOTE_ADDR") '实际ip地址
end if
Function getIP()
Dim sIPAddress, sHTTP_X_FORWARDED_FOR
sHTTP_X_FORWARDED_FOR = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If sHTTP_X_FORWARDED_FOR = "" or InStr(sHTTP_X_FORWARDED_FOR, "unknown") > 0 Then
sIPAddress = Request.ServerVariables("REMOTE_ADDR")
ElseIf InStr(sHTTP_X_FORWARDED_FOR, ",") > 0 Then
sIPAddress = Mid(sHTTP_X_FORWARDED_FOR, 1, InStr(sHTTP_X_FORWARDED_FOR, ",") -1)
ElseIf InStr(sHTTP_X_FORWARDED_FOR, ";") > 0 Then
sIPAddress = Mid(sHTTP_X_FORWARDED_FOR, 1, InStr(sHTTP_X_FORWARDED_FOR, ";") -1)
Else
sIPAddress = sHTTP_X_FORWARDED_FOR
End If
getIP = Trim(Mid(sIPAddress, 1, 15))
End Function
'---------------------
'简化输出
'---------------------
Function I1(I2)
response.Write(I2)
End Function
'====================================================================
'程序调式函数,输出变量并截断
'====================================================================
Function Debug(toWrite)
I1 toWrite
response.End()
End Function
'---------------------
'后台显示信息函数
'---------------------
Function ShowErr(ErrStr,Going)
call pagend()
if Going="1" then
Response.Write "<Script>alert('"& ErrStr &"');location.href='javascript:history.go(-1)';</Script>"
else
Response.Write "<Script>alert('"& ErrStr &"');location.href='"& Going &"';</Script>"
end if
Response.End()
End Function
'---------------------
'字符转换函数
'---------------------
Function HTMLEncode(fString)
If Not IsNull(fString) Then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, " ", " ")
fString = Replace(fString, CHR(64), "®")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "</p><p> ")
fString = Replace(fString, CHR(10), "<br /> ")
HTMLEncode = fString
End If
End Function
'---------------------
'字符转回函数
'---------------------
function HTMLDncode(fString)
If Not IsNull(fString) Then
fString = Replace(fString, ">",">" )
fString = Replace(fString, "<", "<")
fString = Replace(fString, " ", CHR(32))
fString = Replace(fString, " ", " ")
fString = Replace(fString, """, CHR(34))
fString = Replace(fString, "'", CHR(39))
fString = Replace(fString, "®", CHR(64))
fString = Replace(fString, "", CHR(13))
fString = Replace(fString, "</p><p> ",CHR(10) & CHR(10) )
fString = Replace(fString, "<br /> ",CHR(10) )
HTMLDncode = fString
End If
End Function
'---------------------
'结束组件函数
'---------------------
Function pagend()
set rs=nothing
conn.close
set conn=nothing
End Function
Function pagend2()
set rs=nothing
conn1.close
set conn1=nothing
End Function
'---------------------
'判断一致性select
'---------------------
Function Check_id12(id1,id2)
if id1=id2 then
Check_id12=" selected='selected'"
end if
End Function
'---------------------
'判断一致性checked
'---------------------
Function Check_id13(id1,id2)
if id1=id2 then
Check_id13=" checked='checked'"
end if
End Function
function Check_id14(id,text1,text2)
if id=true then
Check_id14=text1
else
Check_id14=text2
end if
end function
'---------------------
'判断字符串长度
'---------------------
Function CheckStringLength(Str)
l = Len(Str)
t = l
For i = 1 To l
c = Asc(Mid(Str, i, 1))
d = AscW(Mid(Str, i, 1))
If c <> d Then
'中文汉字,长度再加1
t = t + 1
End If
Next
CheckStringLength = t
End Function
'Function CheckStringLength(txt)
'txt=trim(txt)
'x = len(txt)
'y = 0
'for ii = 1 to x
' if asc(mid(txt,ii,1))<=0 or asc(mid(txt,ii,1))>255 then
' y = y + 2
' else
' y = y + 1
' end if
'next
'CheckStringLength = y
'End Function
'response.Write(CheckStringLength("你好"))
'---------------------
'判断字符串
'---------------------
Function CheckString(checkstr,sstrlen,strlen,lentype,errstr1,errstr2,errstr3)
if lentype=1 and checkstr="" then
response.Write(errstr1&"|||||")
i=1
exit function
end if
if sstrlen<>0 and CheckStringLength(checkstr)<sstrlen then
response.Write(errstr2&"|||||")
i=1
exit function
end if
if CheckStringLength(checkstr)>strlen then
response.Write(errstr3&"|||||")
i=1
exit function
end if
End Function
'---------------------
'判断是否数字
'---------------------
Function CheckNum(checkstr)
if not isnumeric(checkstr) or checkstr="" then
call ShowErr("参数错误","1")
end if
End Function
Function CheckNum2(ArrayNum)
ArrayNum=split(ArrayNum,",")
for i = 0 to Ubound(ArrayNum)
ArrayNum(i)=trim(ArrayNum(i))
CheckNum(ArrayNum(i))
next
End Function
'---------------------
'判断友情链接显示
'---------------------
Function CheckFriendsShow(Friends_show)
if Friends_show=1 then
CheckFriendsShow="显示"
else
CheckFriendsShow="不显示"
end if
End Function
'---------------------
'判断状态显示
'---------------------
Function ShowType(type_now,type1,type2,type3,show1,show2,show3)
select case type_now
case type1
ShowType=show1
case type2
ShowType=show2
case type3
ShowType=show3
case else
ShowType="参数错误"
end select
End Function
'---------------------
'判断是否数字2
'---------------------
Function CheckNu(checkstr,errstr)
if not isnumeric(checkstr) or checkstr="" then
response.Write(errstr&"|||||")
i=1
end if
End Function
'设置时间格式
function showdt(byval dtvar)
vy=year(dtvar)
vm=month(dtvar)
vd=day(dtvar)
if len(vm)<2 then
vm="0" & vm
end if
if len(vd)<2 then
vd="0" & vd
end if
showdt=vy & "-" & vm & "-" & vd
end function
'------------截取一段文字----------
'利用正则法则,去掉HTML标记
Public Function Replacehtml(Textstr)
Dim Str,re
Str=Textstr
Str=replace(Str," ","")
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(.[^>]*)>"
Str=re.Replace(Str, "")
Set re=Nothing
Replacehtml=Str
End Function
'用省略号格式化数据标题(兼容中文字)
'function CutStr(str,strlen,endStr)
function CutStr(Str,strlen,endStr)
dim cvSt:cvSt=Str
if cvSt="" then
CutStr=""
exit function
end if
dim l,t,c
cvSt=Replacehtml(cvSt) '先去掉HTML标记,在计算长度
l=len(cvSt)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -