Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

75 wiersze
2.6KB

  1. <%
  2. Class HomeController_Class
  3. Public Title
  4. Public useLayout
  5. ' Contact form state shared with the landing view
  6. Private contactErrors
  7. Private contactName
  8. Private contactEmail
  9. Private contactPhone
  10. Private contactBusiness
  11. Private contactMessage
  12. Private contactSent
  13. Private Sub Class_Initialize()
  14. Title = "PostcardMojo Logo Files"
  15. useLayout = False
  16. contactErrors = Array()
  17. ReDim contactErrors(-1)
  18. contactSent = (Request.QueryString("contact") = "sent")
  19. End Sub
  20. Public Sub Index()
  21. %>
  22. <!--#include file="../views/Home/landing.asp" -->
  23. <%
  24. End Sub
  25. ' GetAntiCSRFToken returns an empty value the first time it creates a token, so read it again.
  26. Private Function ContactCsrfToken()
  27. ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact")
  28. If Len(ContactCsrfToken) = 0 Then ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact")
  29. End Function
  30. ' POST /contact - validate the inquiry and email the PostcardMojo team.
  31. Public Sub Contact()
  32. contactName = Trim(Request.Form("name"))
  33. contactEmail = Trim(Request.Form("email"))
  34. contactPhone = Trim(Request.Form("phone"))
  35. contactBusiness = Trim(Request.Form("business"))
  36. contactMessage = Trim(Request.Form("message"))
  37. ' Honeypot: real visitors never see or fill this field
  38. If Len(Request.Form("zq_trap_field")) > 0 Then
  39. Response.Redirect "/?contact=sent#contact"
  40. End If
  41. If Not HTMLSecurity().IsValidAntiCSRFToken("home.contact", Request.Form("csrf_token")) Then
  42. contactErrors = Array("Your session expired. Please try again.")
  43. Else
  44. contactErrors = ContactInquiryService().ValidationErrors(contactName, contactEmail, contactBusiness, contactMessage)
  45. End If
  46. If UBound(contactErrors) < 0 Then
  47. If ContactInquiryService().Notify(contactName, contactEmail, contactPhone, contactBusiness, contactMessage) Then
  48. HTMLSecurity().ClearAntiCSRFToken "home.contact"
  49. Response.Redirect "/?contact=sent#contact"
  50. End If
  51. contactErrors = Array("We could not send your message. Please email danielcovington@postcardmojo.com directly.")
  52. End If
  53. Index
  54. End Sub
  55. End Class
  56. Dim HomeController_Class__Singleton
  57. Function HomeController()
  58. If IsEmpty(HomeController_Class__Singleton) Then
  59. Set HomeController_Class__Singleton = New HomeController_Class
  60. End If
  61. Set HomeController = HomeController_Class__Singleton
  62. End Function
  63. %>

Powered by TurnKey Linux.