一些常會用到的ASP函數
作者:tank 日期:2005-01-09
Public Function CheckBIG(strSource As String) As Boolean
Dim idx As Long
Dim ByteTemp() As Byte
CheckBIG = False
For idx = 1 To Len(strSource)
ByteTemp = StrConv(Mid(strSource, idx, 1), vbFromUnicode)
If Ubound(ByteTemp) > 0 Then
If (ByteTemp(1) >= 64) And (ByteTemp(1) <= 126) Then
CheckBIG = True
Exit For
End If
End If
Next idx
End Function
'******************************
'||Function TimeDiff(sBegin, sEnd)
'||本函數計算兩個時間的差,可以不用更改直接使用
'||作者:machinecat 2001/10/26
'******************************
'******************************
'注:首先需要判斷用戶輸入的sBegin與sEnd之間的大小
'可以通過DataDiff函數獲得兩者之間的時間差,不需要進行復雜的時間換算
'******************************
Function TimeDiff(sBegin, sEnd)
Dim iHourB, iMinuteB, iSecondB, iMiniSecondB
Dim iHourE, iMinuteE, iSecondE, iMiniSecondE
Dim dTimeB, dTimeE, dTimeDiff
Dim iHour, iMinute, iSecond, iMiniSecond
iHourB = clng(Left(sBegin, 2))
iMinuteB = clng(Mid(sBegin, 4, 2))
iSecondB = clng(Mid(sBegin, 7, 2))
iMiniSecondB = clng(Mid(sBegin, 10, 4))
iHourE = clng(Left(sEnd, 2))
iMinuteE = clng(Mid(sEnd, 4, 2))
iSecondE = clng(Mid(sEnd, 7, 2))
iMiniSecondE = clng(Mid(sEnd, 10, 4))
dTimeB = iHourB * 3600 + iMinuteB * 60 + iSecondB + iMiniSecondB / 1000
dTimeE = iHourE * 3600 + iMinuteE * 60 + iSecondE + iMiniSecondE / 1000
dTimeDiff = dTimeE - dTimeB
iHour = Int(dTimeDiff / 3600)
dTimeDiff = dTimeDiff - iHour * 3600
iMinute = Int(dTimeDiff / 60)
dTimeDiff = dTimeDiff - iMinute * 60
iSecond = Int(dTimeDiff)
dTimeDiff = dTimeDiff - Int(dTimeDiff)
iMiniSecond = dTimeDiff
TimeDiff = iHour & "小時" & iMinute & "分鐘" & iSecond & FormatNumber(iMiniSecond, 3) & "秒"
End Function
<%
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
%>
警告!你正在從外部提交數據!!請立即終止!!
<%
Response.Redirect "index.asp"
end if
%>