
<%
dim sessiontimeout
SessionTimeout="9999"
'--------------------不能站外提交数据--------------------
Function IsSelfRefer()
	Dim sHttp_Referer, sServer_Name
	sHttp_Referer = CStr(Request.ServerVariables("HTTP_REFERER"))
	sServer_Name = CStr(Request.ServerVariables("SERVER_NAME"))
	If Mid(sHttp_Referer, 8, Len(sServer_Name)) = sServer_Name Then
		IsSelfRefer = True
	Else
		IsSelfRefer = False
	End If
End Function
'--------------------不能站外提交数据--------------------
'***************************************************
'函数名：IsObjInstalled
'作  用：检查组件是否已经安装
'参  数：strClassString ----组件名
'返回值：True  ----已经安装
'       False ----没有安装
'***************************************************
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

'***************************************************
'函数名：deletepic
'作  用：检查组件是否已经安装
'参  数：no ----组件名
'返回值：UploadFiles  ---- 只留下有用的图片
'***************************************************
dim UploadFiles
function deletepic()
	'***************************************
	'删除无用的上传文件
	if IsObjInstalled("scripting.filesystemobject") and UploadFiles<>"" then

		dim fso,strRubbishFile
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		if instr(UploadFiles,"|")>1 then
			dim arrUploadFiles,intTemp
			arrUploadFiles=split(UploadFiles,"|")
			UploadFiles=""
			for intTemp=0 to ubound(arrUploadFiles)-1

				if instr(Content,arrUploadFiles(intTemp))<=0 then
					strRubbishFile=server.MapPath("../../" & arrUploadFiles(intTemp))
					if fso.FileExists(strRubbishFile) then
						fso.DeleteFile(strRubbishFile)
					end if

				else
						UploadFiles=UploadFiles & arrUploadFiles(intTemp) & "|"


				end if
			next
		else
'			if instr(AContent,UploadFiles)<=0 then
'				strRubbishFile=server.MapPath("../" & UploadFiles)
'				if fso.FileExists(strRubbishFile) then
'					fso.DeleteFile(strRubbishFile)
'				end if
				UploadFiles=""
'			end if
		end if
		set fso=nothing
	end If
	'结束
	'***************************************
end function
'***************************************************
'函数名：DeleteImage(s)
'作  用：删除刷新后的文件
'参  数：s ----组件名
'返回值：blank  ----  无
'***************************************************

function DeleteImage(s)
if isobjinstalled("scripting.filesystemobject") then
dim path
set fso=server.createobject("scripting.filesystemobject")
path=server.mappath("../"&s)
if fso.fileexists(path) then
set	f=fso.getfile(path)
	f.delete True
	set fso=nothing
end if
end if
end function
'***************************************************
'函数名：DeletefileS(s)
'作  用：删除html生成多余文件
'参  数：path ----组件名
'返回值：blank  ----  无
'***************************************************

function DeletefileS(s)
if isobjinstalled("scripting.filesystemobject") then
set fso=server.createobject("scripting.filesystemobject")
path=server.mappath(s)
if fso.fileexists(path) then
set	f=fso.getfile(path)
	f.delete True
	set fso=nothing
end if
end if
end function
'******************************
'函数：FormatDate(DateAndTime, para)
'参数：DateAndTime,要格式化的日期时间；para,样式。
'作者：阿里西西
'日期：2007/7/12
'描述：将日期格式化为需要的格式
'示例：<%=FormatDate(now(), 3)
'******************************
Public Function FormatDate(DateAndTime, para)
On Error Resume Next
Dim y, m, d, h, mi, s, strDateTime
FormatDate = DateAndTime
If Not IsNumeric(para) Then Exit Function
If Not IsDate(DateAndTime) Then Exit Function
y = CStr(Year(DateAndTime))
m = CStr(Month(DateAndTime))
If Len(m) = 1 Then m = "0" & m
d = CStr(Day(DateAndTime))
If Len(d) = 1 Then d = "0" & d
h = CStr(Hour(DateAndTime))
If Len(h) = 1 Then h = "0" & h
mi = CStr(Minute(DateAndTime))
If Len(mi) = 1 Then mi = "0" & mi
s = CStr(Second(DateAndTime))
If Len(s) = 1 Then s = "0" & s
Select Case para
Case "0"
strDateTime = y &  m & d& h  & mi & s
Case "1"
strDateTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s
Case "2"
strDateTime = y & "-" & m & "-" & d
Case "3"
strDateTime = y & "/" & m & "/" & d
Case "4"
strDateTime = y & "年" & m & "月" & d & "日"
Case "5"
strDateTime = m & "-" & d & " " & h & ":" & mi
Case "6"
strDateTime = m & "/" & d
Case "7"
strDateTime = m & "月" & d & "日"
Case "8"
strDateTime = y & "年" & m & "月"
Case "9"
strDateTime = y & "-" & m
Case "10"
strDateTime = y & "/" & m
Case "11"
strDateTime = right(y,2) & "-" &m & "-" & d & " " & h & ":" & mi
Case "12"
strDateTime = right(y,2) & "-" &m & "-" & d
Case "13"
strDateTime = m & "-" & d
Case Else
strDateTime = DateAndTime
End Select
FormatDate = strDateTime
End Function
'***********************************************
'函数名：JoinChar
'作  用：向地址中加入 ? 或 &
'参  数：strUrl  ----网址
'返回值：加了 ? 或 & 的网址
'pos=InStr(1,"abcdefg","cd")
'则pos会返回3表示查找到并且位置为第三个字符开始。
'这就是“查找”的实现，而“查找下一个”功能的
'实现就是把当前位置作为起始位置继续查找。
'***********************************************
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






%>