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

📄 public.asp

📁 如果遇到MD5加密文件
💻 ASP
字号:
<%

Sub DispEndInfo()
	response.write("<center>-----<font color=""red"">"&Application("UnitName")&"</font>-----</center>")
End Sub

'读取system.ini文件中的机关名称和机关代字
Function GetIniFileValue()
	Dim IniObject,IniValue,IniPath,UnitName,UnitWord,ErrorInfo1,ErrorInfo2
	Dim ReturnValueDim(3)
	UnitName=""
	UnitWord=""
	On Error Resume Next
	Set IniObject=Server.CreateObject("ReadIni.IniDll")
	If Err.Number<>0 Then
		ReturnValueDim(1)="不能建立对象!"&err.description
	Else
		IniPath=Server.Mappath("/")&"\Electron_Doc\Public\system.ini"
		Set Fs=Server.CreateObject("Scripting.FileSystemObject")
		If Not Fs.FileExists(IniPath) Then
			ErrorInfo1=IniObject.WriteIniFile("System", "UnitName", "", IniPath)
			ErrorInfo2=IniObject.WriteIniFile("System","UnitWord","",IniPath)
			If ErrorInfo1<>1 Or ErrorInfo2<>1 Then
				ReturnValueDim(1)="建立系统INI文件出错,请手工建立!"
			End If
		Else
			UnitName=IniObject.GetFromINI("System","UnitName",IniPath)
			If UnitName="" Then
				ErrorInfo1=IniObject.WriteIniFile("System", "UnitName", "", IniPath)
				If ErrorInfo1<>1 Then
					ReturnValueDim(1)="建立系统INI文件出错,请手工建立!"
				End If
			End If
			UnitWord=IniObject.GetFromINI("System","UnitWord",IniPath)
			If UnitWord="" Then
				ErrorInfo2=IniObject.WriteIniFile("System","UnitWord","",IniPath)
				If ErrorInfo2<>1 Then
					ReturnValueDim(1)="建立系统INI文件出错,请手工建立!"
				End If
			End If
		End If
	End	If
	Set IniObject=Nothing
	ReturnValueDim(2)=UnitName
	ReturnValueDim(3)=UnitWord
	GetIniFileValue=ReturnValueDim
End Function

'以Javascript弹出警告方式显示错误信息,确定后执行后退操作
Sub DispErrorInfo(ErrorInfoStr)
	Response.Write("<script language=""javascript"">")
	Response.Write("alert("&chr(34)&ErrorInfoStr&chr(34)&");")
	Response.Write("history.go(-1);")
	Response.Write("</script>")
End Sub

'以网页方式显示错误信息,确定后执行后退操作
Sub DispErrorInfo1(ErrorInfoStr)
	Response.Write("<div align=""center"">")
	Response.Write("<br><br>")
	Response.Write("<table border=""0"" cellpadding=""0"" cellspacing=""0"">")
    Response.Write("<tr>")
	Response.Write("<td><img border=""0"" src=""/Electron_Doc/Images/errorico.gif"" align=""absmiddle"" width=""32"" height=""32""> <font size=""3"" color=""#FF0000"">"&ErrorInfoStr&"</font></td>")
	Response.Write("</tr>")
	Response.Write("</table>")
	Response.Write("<br><br>")
	Response.Write("<input type=""button"" Value="" 返 回 "" onclick=""javascript:history.go(-1);"">")
	Response.Write("<br><br>")
	Response.Write("</div>")
End Sub

'以Javascript弹出警告方式显示错误信息,确定后执行关闭窗口操作
Sub DispErrorInfo2(ErrorInfoStr)
	Response.Write("<script language=""javascript"">")
	Response.Write("alert("&chr(34)&ErrorInfoStr&chr(34)&");")
	Response.Write("window.close();")
	Response.Write("</script>")
End Sub

'以Javascript弹出警告方式显示错误信息,确定后执行关闭父窗口操作
Sub DispErrorInfo3(ErrorInfoStr)
	Response.Write("<script language=""javascript"">")
	Response.Write("alert("&chr(34)&ErrorInfoStr&chr(34)&");")
	Response.Write("parent.close();")
	Response.Write("</script>")
End Sub

'以Javascript弹出警告方式显示错误信息
Sub DispErrorInfo4(ErrorInfoStr)
	Response.Write("<script language=""javascript"">")
	Response.Write("alert("&chr(34)&ErrorInfoStr&chr(34)&");")
	Response.Write("</script>")
End Sub	


'关闭数据库连接函数
Function closeconn()
	conn.close
	set conn=nothing
End Function
'格式化输出字符串
Function keepformat(content)
	If isnull(content) then
		keepformat="&nbsp;"
	Else
		str=replace(content," ","&nbsp;")
		str=replace(str,"<","&lt")
		str=replace(str,">","&gt")
		str=replace(str,chr(13)+chr(10),"<p style=""line-height: 150%; margin-top: 2; margin-bottom: 2"">")
		if str="" then
			str="&nbsp;"
		end if
		keepformat=str
	End If
End Function

'返回字符串的实际长度
Function strlength(inputstr)
	Dim length,i
	length=0
	For i=1 To len(inputstr)
		If Asc(Mid(inputstr,i,1))<0 Then
			length=length+2
		Else
			length=length+1
		End If
	Next
	strlength=length
End Function

'确定是否选定该项
Function selected(req,reqvalue)
	if req=reqvalue then
		selected=" selected"
	else
		selected=""
	end if
End Function


'返回字符串的实际长度
function strlength(inputstr)
	dim length,i
	length=0
	for i=1 to len(inputstr)
		if asc(mid(inputstr,i,1))<0 then
			length=length+2
		else
			length=length+1
		end if
	next
	strlength=length
end function

'显示签发人
sub DispSubscribeMan(mainlist)
	dim istemp
	istemp=false
	if mainlist<>"" then
		strdim=split(mainlist,"|")
		for i=0 to ubound(strdim)
			if strdim(i)<>"" then
				response.write("<p style=""line-height: 150%; margin-top: 2; margin-bottom: 2"">"&server.htmlencode(strdim(i)))
				istemp=true
			end if
		next
	end if
	if not istemp then
		response.write("&nbsp;")
	end if
end sub

'返回大写的页号
function getpagenumber(inputpagestr)
	dim numberdim(10)
	numberdim(1)="1"
	numberdim(2)="2"
	numberdim(3)="3"
	numberdim(4)="4"
	numberdim(5)="5"
	numberdim(6)="6"
	numberdim(7)="7"
	numberdim(8)="8"
	numberdim(9)="9"
	numberdim(0)="0"
	suboutputstr=""
	for SlaveID=1 to len(inputpagestr)
		NumberID=cint(mid(inputpagestr,SlaveID,1))
		suboutputstr=suboutputstr&numberdim(NumberID)
	next
	getpagenumber=suboutputstr
end function

'返回大写的日期
function GetMaxDate(datestr)
	dim numberdim(10),yearvalue,monthvalue,dayvalue
	numberdim(1)="一"
	numberdim(2)="二"
	numberdim(3)="三"
	numberdim(4)="四"
	numberdim(5)="五"
	numberdim(6)="六"
	numberdim(7)="七"
	numberdim(8)="八"
	numberdim(9)="九"
	numberdim(0)="O"
	suboutputstr=""
	yearvalue=cstr(year(datestr))
	monthvalue=month(datestr)
	dayvalue=day(datestr)
	for i=1 to len(yearvalue)
		j=cint(mid(yearvalue,i,1))
		suboutputstr=suboutputstr&numberdim(j)
	next
	suboutputstr=suboutputstr&"年"
	if monthvalue<10 then
		suboutputstr=suboutputstr&numberdim(monthvalue)&"月"
	elseif monthvalue=10 then
		suboutputstr=suboutputstr&"十月"
	else
		suboutputstr=suboutputstr&"十"&numberdim(monthvalue mod 10)&"月"
	end if
	if dayvalue<10 then
		suboutputstr=suboutputstr&numberdim(dayvalue)&"日"
	elseif dayvalue=10 then
		suboutputstr=suboutputstr&"十日"
	elseif dayvalue=20 or dayvalue=30 then
		suboutputstr=suboutputstr&numberdim(dayvalue/10)&"十日"
	elseif dayvalue<20 and dayvalue>10 then
		suboutputstr=suboutputstr&"十"&numberdim(dayvalue mod 10)&"日"
	else
		suboutputstr=suboutputstr&numberdim(fix(dayvalue/10))&"十"&numberdim(dayvalue mod 10)&"日"
	end if
	GetMaxDate=suboutputstr
end function

'如果是Null或空值则输出空值,否则输出原值
function keepformat5(inputstr)
	dim returnstr
	if inputstr="" or isnull(inputstr) then
		returnstr=""
	else
		returnstr=server.htmlencode(inputstr)
	end if
	keepformat5=returnstr
end function

'如果是NULL或空值则输出&nbsp字符串,否则输出原值
function keepformat1(inputstr)
	dim returnstr
	if inputstr="" or isnull(inputstr) then
		returnstr="&nbsp;"
	else
		returnstr=server.htmlencode(inputstr)
	end if
	keepformat1=returnstr
end function

function keepformat7(inputstr)
	dim returnstr
	if inputstr="" or isnull(inputstr) then
		returnstr="&nbsp;"
	else
		returnstr=rtrim(inputstr)
		returnstr=replace(returnstr,"<","&lt")
		returnstr=replace(returnstr,">","&gt")
		returnstr=replace(returnstr,chr(13)+chr(10),"<br>")
	end if
	keepformat7=returnstr
end function

'格式化输出公文标题字符串
Function keepformat2(content)
	If isnull(content) then
		keepformat2="&nbsp;"
	Else
		str=replace(content," ","&nbsp;")
		str=replace(str,"<","&lt")
		str=replace(str,">","&gt")
		str=replace(str,chr(13)+chr(10),"<p align=""center"" style=""COLOR: #000000; font-size:22.0pt;mso-bidi-font-size:12.0pt;font-family:宋体;mso-ascii-font-family:仿宋_GB2312;mso-hansi-font-family:""Times New Roman"";mso-font-width:96%;mso-font-kerning:0pt;text-align : center;	line-height : 150%"">")
		if str="" then
			str="&nbsp;"
		end if
		keepformat2=str
	End If
End Function

'格式化输出公文内容
function keepformat3(content)
	str=replace(content," ","&nbsp;")
	str=replace(str,"<","&lt")
	str=replace(str,">","&gt")
	str=replace(str,chr(13)+chr(10),"<p style=""COLOR: #000000;	font-size:16.0pt;mso-bidi-font-size:12.0pt;font-family:仿宋_GB2312;letter-spacing:-.3pt;line-height : 150%;"">")
	keepformat3=str
end function

'格式化输出附注内容
function keepformat4(content)
	str=replace(content," ","&nbsp;")
	str=replace(str,"<","&lt")
	str=replace(str,">","&gt")
	str=replace(str,chr(13)+chr(10),"<p style=""LINE-HEIGHT: 250%; MARGIN-BOTTOM: 0px; MARGIN-TOP: 0px""><span style=""FONT-FAMILY: 仿宋_GB2312; FONT-SIZE: 16pt; LETTER-SPACING: -0.3pt;mso-bidi-font-size: 12.0pt"">")
	keepformat4=str
end function

'生成公文发文字号
function GetDocWordNumber(UnitWord,YearNumber,SerialNumber)
	dim returnvalue
	returnvalue=""
	if trim(UnitWord)<>"" and cstr(YearNumber)<>"0" and  cstr(SerialNumber)<>"0" then
		returnvalue=trim(UnitWord)&"["&cstr(YearNumber)&"]"&cstr(SerialNumber)&"号"
	end if
	GetDocWordNumber=returnvalue
end function

'格式化输出字符串
Function keepformat6(content)
	If isnull(content) then
		keepformat6="&nbsp;"
	Else
		str=replace(content," ","&nbsp;")
		str=replace(str,"<","&lt")
		str=replace(str,">","&gt")
		str=replace(str,chr(13)+chr(10),"<br>")
		if str="" then
			str="&nbsp;"
		end if
		keepformat6=str
	End If
End Function

'检查IP地址是否正确
Function CheckIPAddress(IPSubValue)
	Dim returnvalue
	if not isnumeric(IPSubValue) then
		returnvalue=false
	elseif cint(IPSubValue)<0 or cint(IPSubValue)>255 then
		returnvalue=false
	else
		returnvalue=true
	end if
	CheckIpAddress=returnvalue
End Function

'Ping服务器
Function PingServer(IPAddress)
	Dim PingObject,ReturnValue
	set PingObject=server.createobject("PingSvr.Ping")
	on error resume next
	PingObject.SocketsInitialize()
	PingObject.PingUpsIpAdress=IpAddress
	PingObject.PingServer()
	ReturnValue=PingObject.GetPingResult
	set PingObject=nothing
	PingServer=ReturnValue
End Function
%>

⌨️ 快捷键说明

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