# HG changeset patch # User Matti Hamalainen # Date 1384088131 -7200 # Node ID 988e0ab2b77ef4e446d48936bd14e27396feb963 # Parent 795363f6c86460b54e9f4ab07c13d09f7b06a5be Improve registration process by adding information verification phase. diff -r 795363f6c864 -r 988e0ab2b77e register.inc.php --- 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 "\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 "

Following errors occured:

\n". "\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 @@ "

Oh noes! SQL error happenstance!

"; } } + else + { + echo + "

Verify your information

\n". + "

Is the following information correct?

\n". + "\n"; + + foreach ($formFields as $name => $title) + { + if ($title !== FALSE) + { + echo + " ". + "\n"; + } + } + echo "
".chentities($title).":".chentities(stGetRequestItem($name))."
\n"; + + stPrintFormData("Go back", "start", array("botcheck")); + stPrintFormData("Register", "register"); + } } ?> \ No newline at end of file