changeset 191:988e0ab2b77e

Improve registration process by adding information verification phase.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 10 Nov 2013 14:55:31 +0200
parents 795363f6c864
children 4594594f8b74
files register.inc.php
diffstat 1 files changed, 44 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/register.inc.php	Sat Nov 09 14:28:10 2013 +0200
+++ b/register.inc.php	Sun Nov 10 14:55:31 2013 +0200
@@ -11,17 +11,31 @@
 $botCheckOPs = "bit";
 $botCheckROPs = "+-*";
 
+$formFields = array(
+  "name" => "Name", 
+  "groups" => "Group(s)",
+  "email" => "E-mail",
+  "oneliner" => "Oneliner",
+  "hash" => FALSE,
+  "botcheck" => FALSE,
+);
 
-function stPrintFormData($button, $mode = "start")
+
+function stPrintFormData($button, $mode = "start", $exclude = array())
 {
+  global $formFields;
+
   echo
-  stGetFormStart("register").
-  " ".stGetFormSubmitInput("continue", $button)."\n";
+    stGetFormStart("register").
+    " ".stGetFormSubmitInput("continue", $button)."\n";
 
   stPrintFormHiddenInput("mode", $mode);
-  
-  foreach (array("name", "groups", "email", "oneliner", "hash", "botcheck") as $name)
-    stPrintFormHiddenInput($name, stGetRequestItem($name));
+
+  foreach ($formFields as $name => $title)
+  {
+    if (!in_array($name, $exclude))
+      stPrintFormHiddenInput($name, stGetRequestItem($name));
+  }
 
   echo "</form>\n";
 }
@@ -138,7 +152,7 @@
   echo stGetSetting("registerInfoText");
 }
 else
-if ($mode == "check")
+if ($mode == "check" || $mode == "register")
 {
   //
   // Check the registrant's details
@@ -176,9 +190,10 @@
     echo
       "<p>Following errors occured:</p>\n".
       "<ul>\n".$errorMsg."</ul>\n";
-    stPrintFormData("Go back");
+    stPrintFormData("Go back", "start", array("botcheck"));
   }
   else
+  if ($mode == "register")
   {
     $sql = stPrepareSQL(
       "INSERT INTO attendees (regtime,name,groups,oneliner,email) VALUES (%d,%S,%S,%S,%S)",
@@ -198,5 +213,26 @@
         "<p>Oh noes! SQL error happenstance!</p>";
     }
   }
+  else
+  {
+    echo
+      "<h1>Verify your information</h1>\n".
+      "<p>Is the following information correct?</p>\n".
+      "<table class=\"register\">\n";
+    
+    foreach ($formFields as $name => $title)
+    {
+      if ($title !== FALSE)
+      {
+        echo
+          " <tr><td class=\"".$name."\">".chentities($title).":</td>".
+          "<td>".chentities(stGetRequestItem($name))."</td></tr>\n";
+      }
+    }
+    echo "</table>\n";
+
+    stPrintFormData("Go back", "start", array("botcheck"));
+    stPrintFormData("Register", "register");
+  }
 }
 ?>
\ No newline at end of file