Mercurial > hg > fapweb
comparison 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 |
comparison
equal
deleted
inserted
replaced
25:8606c003ca48 | 26:7be3f8cf1f7a |
---|---|
7 | 7 |
8 | 8 |
9 function stPrintFormData($button, $mode = "start") | 9 function stPrintFormData($button, $mode = "start") |
10 { | 10 { |
11 echo | 11 echo |
12 "<form name=\"register\" action=\"register\" method=\"post\">\n". | 12 stGetFormStart("register"). |
13 " <input type=\"submit\" value=\"".chentities($button)."\" />\n"; | 13 " ".stGetFormSubmitInput("continue", $button)."\n"; |
14 | 14 |
15 stPrintFormHiddenInput("mode", $mode); | 15 stPrintFormHiddenInput("mode", $mode); |
16 | 16 |
17 foreach (array("name", "groups", "email", "oneliner", "hash", "botcheck") as $name) | 17 foreach (array("name", "groups", "email", "oneliner", "hash", "botcheck") as $name) |
18 stPrintFormHiddenInput($name, stGetRequestItem($name)); | 18 stPrintFormHiddenInput($name, stGetRequestItem($name)); |
99 $botCheckOPs[rand(0,2)]. | 99 $botCheckOPs[rand(0,2)]. |
100 intValueToHash(rand(1,5)). | 100 intValueToHash(rand(1,5)). |
101 $botCheckOPs[rand(0,2)]. | 101 $botCheckOPs[rand(0,2)]. |
102 intValueToHash(5 * rand(1,5)); | 102 intValueToHash(5 * rand(1,5)); |
103 | 103 |
104 ?> | 104 echo |
105 <h1>Registration</h1> | 105 "<h1>Registration</h1>\n". |
106 stGetFormStart("register"). | |
107 " ".stGetFormHiddenInput("mode", "check")."\n". | |
108 " ".stGetFormHiddenInput("hash", $botCheckHash)."\n". | |
109 " <table>\n"; | |
110 stPrintFormTextInput("Handle:", "(elite)", 30, 30, "name"); | |
111 stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 40, 64, "groups"); | |
112 stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 40, 64, "email"); | |
113 stPrintFormTextInput("Oneliner:", "(whatever)", 64, 64, "oneliner"); | |
114 stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check". | |
115 //" [".hashToAnswer($botCheckHash)."]". | |
116 ")", 20, 20, "botcheck", "autocomplete=\"off\""); | |
117 echo | |
118 " <tr><td colspan=\"2\"></td><td>".stGetFormSubmitInput("register", "Register")."</td></tr>\n". | |
119 " </table>\n". | |
120 "</form>\n"; | |
106 | 121 |
107 <form name="register" action="register" method="post"> | 122 echo stGetSetting("registerInfoText"); |
108 <input type="hidden" name="mode" value="check"> | |
109 <input type="hidden" name="hash" value="<? echo $botCheckHash ?>"> | |
110 <table> | |
111 <? | |
112 stPrintFormTextInput("Handle:", "(elite)", 30, 30, "name"); | |
113 stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 40, 64, "groups"); | |
114 stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 40, 64, "email"); | |
115 stPrintFormTextInput("Oneliner:", "(whatever)", 64, 64, "oneliner"); | |
116 stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check". | |
117 //" [".hashToAnswer($botCheckHash)."]". | |
118 ")", 20, 20, "botcheck", "autocomplete=\"off\""); | |
119 ?> | |
120 <tr><td colspan="2"></td><td><input type="submit" value="Register" /></td></tr> | |
121 </table> | |
122 </form> | |
123 <? | |
124 echo stGetSetting("registerInfoText"); | |
125 } | 123 } |
126 else | 124 else |
127 if ($mode == "check") | 125 if ($mode == "check") |
128 { | 126 { |
129 if (stChkDataItem("name") || strlen(stGetRequestItem("name")) < 3) | 127 if (stChkDataItem("name") || strlen(stGetRequestItem("name")) < 3) |
137 { | 135 { |
138 if (stChkDataItem("email") || strlen($email) < 4) | 136 if (stChkDataItem("email") || strlen($email) < 4) |
139 stError("E-mail address not given, or it is too short."); | 137 stError("E-mail address not given, or it is too short."); |
140 } | 138 } |
141 | 139 |
142 if (strlen($email >= 4) && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE)) | 140 if (strlen($email) >= 0 && (strpos($email, "@") === FALSE || strpos($email, ".") === FALSE)) |
143 stError("E-mail address not in proper format."); | 141 stError("E-mail address not in proper format."); |
144 | 142 |
145 $hash = stGetRequestItem("hash"); | 143 $hash = stGetRequestItem("hash"); |
146 $answer = stGetRequestItem("botcheck"); | 144 $answer = stGetRequestItem("botcheck"); |
147 if (hashToAnswer($hash) != intval($answer)) | 145 if (hashToAnswer($hash) != intval($answer)) |