" Response.Write "" End Sub Sub DoInputClass(TypeIn) Select Case TypeIn Case 1 : Write "Input" Case 2 : Write "InputDate" Case 3 : Write "InputNum" Case 4 : Write "InputInt" End Select End Sub 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 Function IIF(sInput,strue,sfalse) If sInput then IIF = strue Else IIF = sfalse End if End Function Function PhoneFormat(ByVal TextStr) PhoneFormat = RemovePunctuation(TextStr) if len(PhoneFormat) > 7 AND isNumeric(PhoneFormat) then If "1"=left(PhoneFormat,1) then PhoneFormat = trim(left(PhoneFormat,1)&"-"&Mid(PhoneFormat,2,3)&"-"&Mid(PhoneFormat,5,3)&"-"&Mid(PhoneFormat,8,4)&" "&Mid(PhoneFormat,12)) Else PhoneFormat = trim(Left(PhoneFormat,3)&"-"&Mid(PhoneFormat,4,3)&"-"&Mid(PhoneFormat,7,4)&" "&Mid(PhoneFormat,11)) End if Exit Function End if If len(PhoneFormat) = 7 AND isNumeric(PhoneFormat) then PhoneFormat = Left(PhoneFormat,3)&"-"& Right(PhoneFormat,4) End if End Function Function RemovePunctuation(ByVal TextStr) Dim KeepStr,Char KeepStr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" While 0 < len(TextStr) Char = Mid(TextStr,1,1) TextStr = Mid(TextStr, 2) If 0 < Instr (1, KeepStr, ucase(Char)) then RemovePunctuation = RemovePunctuation & Char Wend End Function Sub NoCachePage() Response.Expires=-1 Response.ExpiresAbsolute = Now()-1 'Response.CacheControl = "no-cache" Response.AddHeader "Cache-Control","no-cache" Response.AddHeader "Pragma", "no-cache" Response.AddHeader "cache-control", "no-store, must-revalidate, private" End sub Sub AddError(OrderIn,MessageIn) errCount=errCount+1 arrErrMsg(OrderIn)=MessageIn End Sub Function ValidateInput(ValueIn, TypeIn, OrderIn) Dim ValidateType, isRequired, TempCount ValidateType = TypeIn isRequired = 0 TempCount = errCount If Mid(strRequired,OrderIn,1)="1" AND NOT Mid(strShowfield,OrderIn,1)="0" then isRequired=-1 Select Case ValidateType Case 1 ' Date If Not isDate(ValueIn) AND isRequired then AddError OrderIn,txtMsgDate Elseif OrderIn="9" then ValueIn=Now() Elseif Not isDate(ValueIn) AND NOT isRequired then ValueIn=Null End If Case 2 ' Numeric If (Trim(ValueIn)="" OR NOT isNumeric(ValueIn)) AND isRequired then AddError OrderIn,txtMsgNum ElseIf NOT isNumeric(ValueIn) AND NOT isRequired AND NOT Trim(ValueIn)="" then AddError OrderIn,txtMsgNum Elseif Trim(ValueIn)="" then ValueIn=0 End if Case 3 ' String If arrMaxLth(OrderIn) <> "" AND (Len(ValueIn) > arrMaxLth(OrderIn)) then AddError OrderIn, txtMsgMaxStrLth &" <= "& arrMaxLth(OrderIn) &"" Else If Trim(ValueIn)="" AND isRequired then AddError OrderIn,txtMsgRequired Elseif OrderIn=4 AND Len(ValueIn) <= r_usr_min then AddError OrderIn,txtMsgStrLgth &" > "&r_usr_min&"" Elseif OrderIn=4 AND CheckInput(Trim(ValueIn))=-1 then AddError OrderIn,txtMsgCharacters End if End If Case 4 ' Bool ValueIn=ValueIn Case 5 ' Email If Trim(ValueIn)="" AND isRequired Then AddError OrderIn,txtMsgRequired ElseIf Trim(ValueIn) <> "" AND test(ValueIn) = False Then AddError OrderIn,txtMsgEmailInvalid End if Case Else errCount="1" End Select If TempCount < errCount then arrValInput(OrderIn)="1" ValidateInput=Trim(CleanStr(ValueIn)) End Function Function ValidatePassword(PasswordI,PasswordII) Dim TempCount TempCount = errCount If CheckInput(PasswordI)=-1 then AddError 7,txtMsgCharacters Elseif (PasswordI="" AND PasswordII="") then AddError 7,txtMsgRequired Elseif (PasswordI <> PasswordII) then AddError 7,txtMsgPassMatch ElseIf (PasswordI=PasswordII) AND (len(PasswordI)<=r_pass_min) then AddError 7,txtMsgStrLgth &" > "&r_pass_min&"" ElseIf (PasswordI = PasswordII) AND (len(PasswordI) >= r_pass_min AND len(PasswordI) > arrMaxLth(7)) then AddError 7,txtMsgMaxStrLth &" <= "&arrMaxLth(7)&"" End if If TempCount < errCount then arrValInput(7)= "1" ValidatePassword = PasswordI End Function Function GeneratePassword() DIM Password_Length,newPassword,countpwd Password_Length=6 Randomize() newPassword="" countpwd=0 DO UNTIL countpwd = PASSWORD_LENGTH pwd=Int((122-97+1) * Rnd+97) newPassword=newPassword+Chr(pwd) countpwd=countpwd+1 Loop generatePassword=newPassword End Function