%@LANGUAGE="VBSCRIPT"%> <%Option Explicit%> <% Dim strError Dim SessionCAPTCHA_TB strError = "" If LCase(Request.ServerVariables("REQUEST_METHOD")) = "post" Then If CheckCAPTCHA(Request.Form("strCAPTCHA")) Then Server.Transfer("gdform.asp") Else strError = "Invalid verification code. Please try again." SessionCAPTCHA_TB = "xcap" + GenerateRandomString(3) Session("CAPTCHA_TB") = SessionCAPTCHA_TB End If Else SessionCAPTCHA_TB = "xcap" + GenerateRandomString(3) Session("CAPTCHA_TB") = SessionCAPTCHA_TB End If Function CheckCAPTCHA(valCAPTCHA) Dim SessionCAPTCHA SessionCAPTCHA = Trim(Session("CAPTCHA")) SessionCAPTCHA_TB = CSTR(Trim(Session("CAPTCHA_TB"))) If Len(SessionCAPTCHA) < 1 Then CheckCAPTCHA = False Exit Function ElseIf Request.Form(SessionCAPTCHA_TB) <> "" Then CheckCAPTCHA = False Exit Function End If If CStr(SessionCAPTCHA) = CStr(valCAPTCHA) Then CheckCAPTCHA = True Else CheckCAPTCHA = False End If End Function Function GenerateRandomString(iLength) 'Declare variables Dim sDefaultChars Dim iCounter Dim sBuffer Dim iPickedChar Dim iDefaultCharactersLength 'Initialize variables sDefaultChars="abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ" iDefaultCharactersLength = Len(sDefaultChars) sBuffer = "" Randomize 'initialize the random number generator 'Loop for the number of characters password is to have For iCounter = 1 To iLength iPickedChar = Int((iDefaultCharactersLength * Rnd) + 1) sBuffer = sBuffer & Mid(sDefaultChars,iPickedChar,1) Next GenerateRandomString = sBuffer End Function Function CheckToCheck(strID, defVal) If LCase(Request.ServerVariables("REQUEST_METHOD")) = "post" Then If(Request.Form(strID) = "checkbox") Then CheckToCheck = "checked=true" Else CheckToCheck = "" End If ElseIf defVal = True Then CheckToCheck = "checked=true" End If End Function %>
![]() |
![]() |
|
|||||||||||||||||||||||