home - projects - login - links

Project: ScoutsLint.be V1: Verjaardagskalender

Location: root /

File: Verjaardag_comment_process.asp

expand uitklappen
  1. <!--#include file="includes/top.asp"-->
  2. <%
  3. dim comm_naam, comm_datum, comm_text, comm_dag, comm_maand, comment_ip,comm_code, date_part
  4. dim arrMaandenLang(12), arrDagen(7)
  5.  
  6. set objConn = server.CreateObject("ADODB.Connection")
  7. objConn.Open strConnection
  8. Set objRS=Server.CreateObject("ADODB.Recordset")
  9.  
  10. arrMaandenLang(1) = "januari"
  11. arrMaandenLang(2) = "februari"
  12. arrMaandenLang(3) = "maart"
  13. arrMaandenLang(4) = "april"
  14. arrMaandenLang(5) = "mei"
  15. arrMaandenLang(6) = "juni"
  16. arrMaandenLang(7) = "juli"
  17. arrMaandenLang(8) = "augustus"
  18. arrMaandenLang(9) = "september"
  19. arrMaandenLang(10) = "oktober"
  20. arrMaandenLang(11) = "november"
  21. arrMaandenLang(12) = "december"
  22.  
  23. arrDagen(1) = "zondag"
  24. arrDagen(2) = "maandag"
  25. arrDagen(3) = "dinsdag"
  26. arrDagen(4) = "woensdag"
  27. arrDagen(5) = "donderdag"
  28. arrDagen(6) = "vrijdag"
  29. arrDagen(7) = "zaterdag"
  30.  
  31. if (Request.Form("commentplaatsen") <> "") then
  32. ' Form verwerkt
  33. comm_naam = trim(Request.Form("comment_naam"))
  34. comm_naam = left(comm_naam, 45) 'Maximale lengt in mysql: 45
  35. date_part = DatePart("d", date())
  36. comm_datum = arrDagen(DatePart("w", date())) & " " & date_part & " " & arrMaandenLang(DatePart("m", date())) & ", om "
  37. date_part = DatePart("h", time())
  38. if (date_part < 10) then
  39. date_part = "0" & date_part
  40. end if
  41. comm_datum = comm_datum & date_part & ":"
  42. date_part = DatePart("n", time())
  43. if (date_part < 10) then
  44. date_part = "0" & date_part
  45. end if
  46. comm_datum = comm_datum & date_part
  47. 'comm_datum = & " " & DatePart("d", date()) & " " & arrMaandenLang(DatePart("m", date())) & ", om " & DatePart("h", time()) & ":" & DatePart("n", time())
  48. comm_text = trim(Request.Form("comment_text"))
  49. comm_maand = trim(Request.Form("comm_maand"))
  50. comm_dag = trim(Request.Form("comm_dag"))
  51. comm_code = trim(Request.Form("comment_code"))
  52. comment_ip = request.servervariables ("remote_addr")
  53.  
  54. 'Input veilig stellen
  55. comm_text = Replace(comm_text, ">", "&gt;")
  56. comm_text = Replace(comm_text, "<", "&lt;")
  57.  
  58. if (comm_naam <> "" AND comm_text <> "" ) then
  59. objRS.CursorLocation = adUseServer
  60. objRS.CursorType = adOpenKeyset
  61. objRS.LockType = adLockOptimistic
  62. objRS.Open "tblverjaardagcomment", objConn, , , adCmdTable
  63.  
  64. objRS.AddNew
  65. objRS("comment_naam") = comm_naam
  66. objRS("comment_date") = comm_datum
  67. objRS("comment_text") = comm_text
  68. objRS("comment_ip") = comment_ip
  69. objRS("comment_dag") = comm_dag
  70. objRS("comment_maand") = comm_maand
  71.  
  72. if (comm_code = "vier") then
  73. 'Code correct
  74. objRS.Update
  75. objRS.Close
  76.  
  77. response.Redirect ("Verjaardag_comment.asp?vDag=" & comm_dag & "&vMaand=" & comm_maand)
  78. response.Write ("Je wordt automatisch doorverbonde naar de correcte pagina. <br />Mocht dat toch niet gebeuren, kan je <a href='Verjaardag_comment.asp?vDag=" & comm_dag & "&vMaand=" & comm_maand & "'>deze link gebruiken</a>.")
  79. else
  80. response.Write ("De code was foutief ingegeven. Ga terug naar de vorige pagina en geef de correcte code in.<br />Tip: de correcte code is <b>vier</b> (in letters).")
  81. end if
  82. else
  83. response.Write ("Er waren lege velden. Vul alle velden in, en probeer opnieuw.")
  84. end if
  85. else
  86. response.Write ("Je komt rechstreeks op deze pagina. Endamagni!")
  87. end if
  88.  
  89. %>
  90. <!--#include file="includes/bottom.asp"-->