diff register.inc.php @ 26:7be3f8cf1f7a

Lots of cleanups, preparing for adding entry submission support.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 08 Dec 2012 04:57:32 +0200
parents 6da681d1f62a
children 1fccb8f031ed
line wrap: on
line diff
--- a/register.inc.php	Fri Dec 07 23:31:23 2012 +0200
+++ b/register.inc.php	Sat Dec 08 04:57:32 2012 +0200
@@ -9,8 +9,8 @@
 function stPrintFormData($button, $mode = "start")
 {
   echo
-  "<form name=\"register\" action=\"register\" method=\"post\">\n".
-  " <input type=\"submit\" value=\"".chentities($button)."\" />\n";
+  stGetFormStart("register").
+  " ".stGetFormSubmitInput("continue", $button)."\n";
 
   stPrintFormHiddenInput("mode", $mode);
   
@@ -101,27 +101,25 @@
     $botCheckOPs[rand(0,2)].
     intValueToHash(5 * rand(1,5));
 
-?>
-<h1>Registration</h1>
+  echo
+  "<h1>Registration</h1>\n".
+  stGetFormStart("register").
+  " ".stGetFormHiddenInput("mode", "check")."\n".
+  " ".stGetFormHiddenInput("hash", $botCheckHash)."\n".
+  " <table>\n";
+  stPrintFormTextInput("Handle:", "(elite)", 30, 30, "name");
+  stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 40, 64, "groups");
+  stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 40, 64, "email");
+  stPrintFormTextInput("Oneliner:", "(whatever)", 64, 64, "oneliner");
+  stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check".
+  //" [".hashToAnswer($botCheckHash)."]".
+  ")", 20, 20, "botcheck", "autocomplete=\"off\"");
+  echo
+  "  <tr><td colspan=\"2\"></td><td>".stGetFormSubmitInput("register", "Register")."</td></tr>\n".
+  " </table>\n".
+  "</form>\n";
 
-<form name="register" action="register" method="post">
- <input type="hidden" name="mode" value="check">
- <input type="hidden" name="hash" value="<? echo $botCheckHash ?>">
- <table>
-<?
-stPrintFormTextInput("Handle:", "(elite)", 30, 30, "name");
-stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 40, 64, "groups");
-stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 40, 64, "email");
-stPrintFormTextInput("Oneliner:", "(whatever)", 64, 64, "oneliner");
-stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check".
-//" [".hashToAnswer($botCheckHash)."]".
-")", 20, 20, "botcheck", "autocomplete=\"off\"");
-?>
-  <tr><td colspan="2"></td><td><input type="submit" value="Register" /></td></tr>
- </table>
-</form>
-<?
-echo stGetSetting("registerInfoText");
+  echo stGetSetting("registerInfoText");
 }
 else
 if ($mode == "check")
@@ -139,7 +137,7 @@
       stError("E-mail address not given, or it is too short.");
   }
 
-  if (strlen($email >= 4) && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE))
+  if (strlen($email) >= 0 && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE))
     stError("E-mail address not in proper format.");
 
   $hash = stGetRequestItem("hash");