<%
Function getQueryString(theVar,theType)
	Dim theData
		theData = TRim(Request.QueryString(theVar))
		If Len(theData) = 0 Then theData = Null:Exit Function
	Select Case Cstr(LCase(theType))
		Case "num","int"
			If CheckData(theData,theType,1) = False Then theData = 0
		Case Else
			If CheckData(theData,theType,1) = False Then theData = ""
	End Select
	getQueryString = theData
End Function
Function CheckData(theData,theType,theGlobal)
	Dim thePattern
	Select Case Cstr(LCase(theType))
	Case "num"              ' @ 数字
		thePattern = "([+-]?)(\d*)([.]?)(\d*)"
	Case "int"              ' @ 整型
		thePattern = "(\d+)"
	Case "letter"           ' @ 字母
		thePattern = "[A-Za-z]+"
	Case "ip"              ' @ IP地址
		thePattern = "((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)"
	Case "tel"             ' @ 电话号码
		thePattern = "(0\d{2,3}\-?)([2-9]\d{7,8})"
	Case "mob"             ' @ 手机号码
		thePattern = "(0)?(13|15)(\d{9})"
	Case "usrname"         ' @ 用户名
		thePattern = "([A-Za-z0-9\u4e00-\u9fa5][A-Za-z0-9\u4e00-\u9fa5\-\_]{0,10}[A-Za-z0-9\u4e00-\u9fa5])"
	Case "usrpass"         ' @ 密码
		thePattern = "\w{5,20}"
	Case "idlist"          ' @ ID列表
		thePattern = "[\d,]+"
	Case "chinese"         ' @ 中文加字母
		thePattern = "[a-zA-Z\u4e00-\u9fa5]+"
	Case "train"
		thePattern = "[a-zA-Z0-9\/]+"
	Case Else
		thePattern = "[a-zA-Z0-9\,\/\-\_\[\]]+"
	End Select
	If CStr(theGlobal) = "1" Then thePattern = "^" & thePattern & "$"
	Dim regEx, Match
		Set regEx = New RegExp
		regEx.Pattern = thePattern
		regEx.IgnoreCase = True
		Set Match = regEx.Execute(theData)
	If Match.Count Then CheckData = True Else CheckData = False
End Function
' @ 扫描元素 theItem 是否在元素列表 theItemList 中
Function InList(theItemList,theItem)
	InList = False
	If Not Check(theItemList,"idlist",1) Or IsNull(theItem) Then
		Exit Function
	End If
	theItemList = Replace(theItemList," ","")
	If Instr(","&theItemList&",",","&theItem&",") >= 1 Then
		InList = True
	End If
End Function
' 时间格式化
Function FormatMyDate(theTime)
	Dim theHour, theMin
		theMin = theTime Mod 60
		theHour = Int((theTime - theMin)/60)
		FormatMyDate = Right("00" & theHour,2) & ":" & Right("00" & theMin,2)
End Function
Function Days(theDays)
	Select Case CStr(TRim(theDays))
	Case "1" Days = "当天"
	Case Else Days = "第" & theDays & "天"
	End Select
End Function
%>
