%@ Language=VBScript%> <% mes = "" IsSuccess = false CaptchaSuccess = false sTo = "chris.baham@nationalcounselinggroup.com, connections@nationalcounselinggroup.com" sFrom = "tfc@nationalcounselinggroup.com" sSubject = "Sign Up for Therapeutic Foster Care" sMailServer = "127.0.0.1" sBody = Trim("Full Name: " & Request.Form("name")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("E-mail Address: " & Request.Form("email")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Address: " & Request.Form("address")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("City: " & Request.Form("city")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("State: " & Request.Form("state")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Zip Code: " & Request.Form("zipcode")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Phone: " & Request.Form("phone")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Looking for more information?: " & Request.Form("info")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Want to become a foster parent?: " & Request.Form("parent")) & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Trim("Comments: " & Request.Form("comments")) if Request("__action")="SendEMail" then ValidateCaptcha() if CaptchaSuccess then SendEMail() end if end if Sub ValidateCaptcha() If UCase(Request.Form(NAME_OF_CAPTCHA_TEXTBOX)) = UCase(Session("CAPTCHA")) Then CaptchaSuccess = true Else mes = "Please answer the security question correctly." End If End Sub Sub SendEMail() Set objMail = Server.CreateObject("CDO.Message") Set objConf = Server.CreateObject("CDO.Configuration") Set objFields = objConf.Fields With objFields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Update End With With objMail Set .Configuration = objConf .From = sFrom .To = sTo .Subject = sSubject .TextBody = sBody End With Err.Clear on error resume next objMail.Send if len(Err.Description) = 0 then mes = "Thank you. Your registration has been sent successfully." IsSuccess = true else mes = "An error occured while trying to send your registration." end if Set objFields = Nothing Set objConf = Nothing Set objMail = Nothing End sub Sub Alert(html) if IsSuccess then Response.Write "
" & m_arrQuestions(m_lngQuestionIndex) & "
" & vbCrLf m_sJavascript = sJScript End Sub '------------------------------------------------------------------------------------------------------------ ' Comment: Randomize array but make sure all values are present in the new array. '------------------------------------------------------------------------------------------------------------ Function RandomizeArrayUnique(arr, arrNew) On Error Resume Next Dim i, l, sBuf, sTmp, iMax iMax = UBound(arr) ReDim arrNew(iMax) For i = 0 To iMax '// This should be enough looping For l = 1 To (iMax * 20) sTmp = arr(RandomNumber(iMax + 1)) If InStr(sBuf, sTmp) = 0 Then sBuf = (sBuf & sTmp) arrNew(i) = sTmp Exit For End If Next Next End Function '------------------------------------------------------------------------------------------------------------ ' Comment: Randomize our module arrays holding the CSS. One value might appear several times. '------------------------------------------------------------------------------------------------------------ Function RandomizeArray(arr, arrNew) On Error Resume Next Dim i ReDim arrNew(UBound(arr)) For i = LBound(arr) To UBound(arr) arrNew(i) = arr(RandomNumber(UBound(arr) + 1)) Next End Function '------------------------------------------------------------------------------------------------------------ ' Comment: Return a random number not bigger than the input parameter. '------------------------------------------------------------------------------------------------------------ Function RandomNumber(iMax) On Error Resume Next Randomize RandomNumber = Int(iMax * Rnd) End Function '------------------------------------------------------------------------------------------------------------ ' Comment: Create a random string of lower case letters [a-z] for the css class names. '------------------------------------------------------------------------------------------------------------ Function RandomString(iMax) On Error Resume Next Dim i, sTmp For i = 1 To iMax sTmp = sTmp & Chr(97 + RandomNumber(26)) '// Return a random number between 97 and 122, ascii values for [a-z] Next RandomString = sTmp End Function '============================================================ END OF ASP CODE %>![]() |
![]() |
|
| ©2008–2012 All Rights Reserved, National Counseling Group, Inc. | 1.877.KNOWNCG |