選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

82 行
2.7KB

  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. ' GET /privacy - the privacy policy page.
  26. Public Sub Privacy()
  27. %>
  28. <!--#include file="../views/Home/privacy.asp" -->
  29. <%
  30. End Sub
  31. ' GetAntiCSRFToken returns an empty value the first time it creates a token, so read it again.
  32. Private Function ContactCsrfToken()
  33. ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact")
  34. If Len(ContactCsrfToken) = 0 Then ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact")
  35. End Function
  36. ' POST /contact - validate the inquiry and email the PostcardMojo team.
  37. Public Sub Contact()
  38. contactName = Trim(Request.Form("name"))
  39. contactEmail = Trim(Request.Form("email"))
  40. contactPhone = Trim(Request.Form("phone"))
  41. contactBusiness = Trim(Request.Form("business"))
  42. contactMessage = Trim(Request.Form("message"))
  43. ' Honeypot: real visitors never see or fill this field
  44. If Len(Request.Form("zq_trap_field")) > 0 Then
  45. Response.Redirect "/?contact=sent#contact"
  46. End If
  47. If Not HTMLSecurity().IsValidAntiCSRFToken("home.contact", Request.Form("csrf_token")) Then
  48. contactErrors = Array("Your session expired. Please try again.")
  49. Else
  50. contactErrors = ContactInquiryService().ValidationErrors(contactName, contactEmail, contactBusiness, contactMessage)
  51. End If
  52. If UBound(contactErrors) < 0 Then
  53. If ContactInquiryService().Notify(contactName, contactEmail, contactPhone, contactBusiness, contactMessage) Then
  54. HTMLSecurity().ClearAntiCSRFToken "home.contact"
  55. Response.Redirect "/?contact=sent#contact"
  56. End If
  57. contactErrors = Array("We could not send your message. Please email danielcovington@postcardmojo.com directly.")
  58. End If
  59. Index
  60. End Sub
  61. End Class
  62. Dim HomeController_Class__Singleton
  63. Function HomeController()
  64. If IsEmpty(HomeController_Class__Singleton) Then
  65. Set HomeController_Class__Singleton = New HomeController_Class
  66. End If
  67. Set HomeController = HomeController_Class__Singleton
  68. End Function
  69. %>

Powered by TurnKey Linux.