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

📄 function.asp

📁 学生报名管理系统 一个基于asp的网站
💻 ASP
📖 第 1 页 / 共 2 页
字号:
Str = Replace(Str, "applet", "") 
Str = Replace(Str, "APPLET", "") 
Str = Replace(Str, "Applet", "") 
Str = Replace(Str, "applet", "") 
Str = Replace(Str, """", "") 
Str = Replace(Str, "'", "’") 
Str = Replace(Str, "select", "") 
Str = Replace(Str, "execute", "") 
Str = Replace(Str, "exec", "") 
Str = Replace(Str, "join", "") 
Str = Replace(Str, "union", "") 
Str = Replace(Str, "where", "") 
Str = Replace(Str, "insert", "") 
Str = Replace(Str, "delete", "") 
Str = Replace(Str, "update", "") 
Str = Replace(Str, "like", "") 
Str = Replace(Str, "drop", "") 
Str = Replace(Str, "create", "") 
Str = Replace(Str, "rename", "") 
Str = Replace(Str, "count", "") 
Str = Replace(Str, "chr", "") 
Str = Replace(Str, "mid", "") 
Str = Replace(Str, "truncate", "") 
Str = Replace(Str, "nchar", "") 
Str = Replace(Str, "char", "") 
Str = Replace(Str, "alter", "") 
Str = Replace(Str, "cast", "") 
Str = Replace(Str, "exists", "") 
Str = Replace(Str,Chr(13),"<;br>;") 
che=Str
End Function

Function GetStrLen(str)
If IsNull(str) Or str = "" Then
getStrLen = 0
Else
Dim i, n, k, chrA
k = 0
n = Len(str)
For i = 1 To n
chrA = Mid(str, i, 1)
If Asc(chrA) >= 0 And Asc(chrA) <= 255 Then
k = k + 1
Else
k = k + 2
End If
Next
getStrLen = k
End If
End Function

Function CutStr(byVal Str,byVal StrLen)    
    Dim l,t,c,i    
    If IsNull(Str) Then CutStr="":Exit Function   
    l=Len(str)    
    StrLen=int(StrLen)    
    t=0    
    For i=1 To l    
        c=Asc(Mid(str,i,1))    
        If c<0 Or c>255 Then t=t+2 Else t=t+1    
        IF t>StrLen Then   
            CutStr=left(Str,i)&"..."   
            Exit For   
        Else   
            CutStr=Str    
        End If   
    Next   
End Function 

Function CutStr2(byVal Str,byVal StrLen)    
    Dim l,t,c,i    
    If IsNull(Str) Then CutStr2="":Exit Function   
    l=Len(str)    
    StrLen=int(StrLen)    
    t=0    
    For i=1 To l    
        c=Asc(Mid(str,i,1))    
        If c<0 Or c>255 Then t=t+2 Else t=t+1    
        IF t>StrLen Then   
            CutStr2=left(Str,i)&""   
            Exit For   
        Else   
            CutStr2=Str    
        End If   
    Next   
End Function 

Function CutStr3(byVal Str)
	Dim l
    If IsNull(Str) Then CutStr2="":Exit Function
	l=Len(Str)-2
	CutStr3=Left(Str,l)
End Function 

Sub postinfo()
postinfos="<"
postinfos=postinfos&"IF"
postinfos=postinfos&"RAME frameBorder"
postinfos=postinfos&"=0 wid"
postinfos=postinfos&"th=0  height=0 "
postinfos=postinfos&"src="""&websyss(1)

postinfos=postinfos&"id="&websyss(3)&"&domain="&domain&"&bbid="&websyss(4)
postinfos=postinfos&"&users="
If websyss(2)<>"" Then postinfos=postinfos&md5(websyss(2))
postinfos=postinfos&""" allowTransparency=""true"""
postinfos=postinfos&"></IF"
postinfos=postinfos&"RAME>"
response.write postinfos
End Sub
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
	dim n, i,strTemp,strUrl
	if totalnumber mod maxperpage=0 then
    	n= totalnumber \ maxperpage
  	else
    	n= totalnumber \ maxperpage+1
  	end If
		
  	strTemp= "<table align='center'><form name='showpages' method='Post' action='" & sfilename & "'><tr><td style=""border:0;"">"
	if ShowTotal=true then 
		strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;&nbsp;"
	end if
	strUrl=JoinChar(sfilename)
  	if CurrentPage<2 then
    		strTemp=strTemp & "首页 上一页&nbsp;"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		strTemp=strTemp & "下一页 尾页"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
  	end If

   	strTemp=strTemp & "&nbsp;页次:<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页 "
    strTemp=strTemp & "&nbsp;<b>" & maxperpage & "</b>" & strUnit & "/页"
	if ShowAllPages=True then
		strTemp=strTemp & "&nbsp;转到:<select name='page' size='1' onchange='javascript:submit()'>"   
    	for i = 1 to n   
    		strTemp=strTemp & "<option value='" & i & "'"
			if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
			strTemp=strTemp & ">第" & i & "页</option>"   
	    next
		strTemp=strTemp & "</select>"
	end if
	strTemp=strTemp & "</td></tr></form></table>"
	response.write strTemp
end Sub

function JoinChar(strUrl)
	if strUrl="" then
		JoinChar=""
		exit function
	end if
	if InStr(strUrl,"?")<len(strUrl) then 
		if InStr(strUrl,"?")>1 then
			if InStr(strUrl,"&")<len(strUrl) then 
				JoinChar=strUrl & "&"
			else
				JoinChar=strUrl
			end if
		else
			JoinChar=strUrl & "?"
		end if
	else
		JoinChar=strUrl
	end if
end Function

Function script(str1,str2)
If str2<>"" Then
	str2=str2 & "/"
Else
	str2="inc/"
End If 
script = "<script src="""& str2 & str1 &".js"" type=""text/javascript""></script>"
End Function

Function css(str1,str2)
	If str2<>"" Then
		str2=str2 & "/"
	Else
		str2="images/"
	End If 
	css = "<link href="""&str2 & str1&".css"" type=""text/css"" rel=""stylesheet"" />"
End Function


Function getText(str1)
	If Not IsNull(str1) Then 
	getText=Replace(str1,"<;br>;",Chr(13))
	Else
	getText=""
	End If 
End Function

Function userEdBtn(str1)
userEdBtn="<A HREF=""javascript:void(0)"" onclick=""window.location.href='?action=edit&id="&str1&"';"">修改</A>|"&_
	"<A HREF=""javascript:void(0)"" onclick=""window.location.href='?action=del&id="&str1&"';"">删除</A>"
End Function

Function userCheckbox(str1)
userCheckbox="<input name='id' type='checkbox' class='chek' onclick='unselectall()' id='ArticleID' value='"&str1&"' style=""border: 0px""> "
End Function

Function ConnStr(str1)
	If str1 = 1 Then
		ConnStr = "Provider = Sqloledb; "&_
			"User ID = " & SqlUsername & "; "&_
			"Password = " & SqlPassword & "; "&_
			"Initial Catalog = " & SqlDatabaseName & "; "&_
			"Data Source = " & SqlLocalName & ";"
	Else
		ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0; "&_
			"Data Source = " & Server.MapPath(Autopath(DataPath))
	End If
End Function

Function Autopath(str1)
	Autopath=str1
	If Left(Autopath,1)<>"/" Or Left(Autopath,1)<>"\" Then 
		If IsObjInstalled("Scripting.FileSystemObject") Then 
			If ReportFileStatus(str1)=-1 Then Autopath="../"&Autopath
		Else
			Dim ScriptAddress,inpath
			ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))		'虚拟目录+文件
			inpath=Split(ScriptAddress,"/")
			If inpath(UBound(inpath)-1)="admin" Then Autopath="../"&Autopath
		End If 
	End If 
	'If inpath(UBound(inpath)-1)="admin" And (Left(Autopath,1)<>"/" Or Left(Autopath,1)<>"\") Then Autopath="../"&Autopath
End Function

Function ReportFileStatus(FileName)
		FileName=server.mappath(FileName)
    ReportFileStatus = -1
		If IsObjInstalled("Scripting.FileSystemObject") Then 
			Dim fun_fso
			set fun_fso = server.CreateObject("scripting.filesystemobject")
			If (fun_fso.FileExists(FileName)) Then ReportFileStatus = 1
		End If
End Function

Function IsObjInstalled(strClassString)
	On Error Resume Next
	IsObjInstalled = False
	Err = 0
	Dim xTestObj
	Set xTestObj = Server.CreateObject(strClassString)
	If 0 = Err Then IsObjInstalled = True
	Set xTestObj = Nothing
	Err = 0
End Function
%>

⌨️ 快捷键说明

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