annotate pages/register.inc.php @ 1062:7135c7b18bb9

Add linefeed.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 17 Nov 2016 14:20:00 +0200
parents 42cf6048a594
children 7e497188e4c6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 <?
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
2 //
571
ce11ea112a65 Change the header blurb a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 565
diff changeset
3 // FAPWeb - Simple Web-based Demoparty Management System
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
4 // Attendee registration page
1001
ffacd904fd1f Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 771
diff changeset
5 // (C) Copyright 2012-2015 Tecnic Software productions (TNSP)
136
aeebfedb5709 Add some copyright headers.
Matti Hamalainen <ccr@tnsp.org>
parents: 103
diff changeset
6 //
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 $mode = stGetRequestItem("mode", "start");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
9 // Settings for robot check hash generator
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 $botCheckIDs = "aBcdefghIjklmnopqrsTuvxyz0123456";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11 $botCheckOPs = "bit";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 $botCheckROPs = "+-*";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
14 $registerFormFields =
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
15 [
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
16 "name" => "Name",
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
17 "groups" => "Group(s)",
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
18 "email" => "E-mail",
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
19 "oneliner" => "Oneliner",
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
20 "hash" => FALSE,
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
21 "botcheck" => FALSE,
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
22 ];
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
24
734
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
25 function stPrintFormTextInput($text1, $text2, $size, $len, $name, $extra="")
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
26 {
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
27 echo " <tr><th>".chentities($text1)."</th><td>".
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
28 stGetFormTextInput($size, $len, $name, "", "", stGetRequestItem($name), $extra).
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
29 "</td><td>".chentities($text2)."</td></tr>\n";
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
30 }
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
31
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
32
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
33 function stPrintFormHiddenInput($name, $value)
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
34 {
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
35 echo " ".stGetFormHiddenInput($name, $value)."\n";
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
36 }
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
37
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
38
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
39 function stPrintFormData($button, $mode = "start", $exclude = array())
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 {
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
41 global $registerFormFields;
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
42
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 echo
771
cd8a29647c09 Change the API of stGetFormStart().
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
44 stGetFormStart("register", "register").
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
45 " ".stGetFormSubmitInput("continue", $button)."\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 stPrintFormHiddenInput("mode", $mode);
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
48
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
49 foreach ($registerFormFields as $name => $title)
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
50 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
51 if (!in_array($name, $exclude))
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
52 stPrintFormHiddenInput($name, stGetRequestItem($name));
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
53 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 echo "</form>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
1016
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
59 function stPrintRegistrationErrors()
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
60 {
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
61 global $errorMsgs;
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
62
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
63 echo
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
64 "<h1>Following errors occured:</h1>\n".
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
65 "<ul>\n";
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
66
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
67 foreach ($errorMsgs as $msg)
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
68 echo " <li>".$msg."</li>\n";
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
69
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
70 echo "</ul>\n";
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
71 stPrintFormData("Go back", "start", array("botcheck"));
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
72 }
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
73
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
74
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
75 // Convert integer value to hash code
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 function intValueToHash($val)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 global $botCheckIDs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 $str = "";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 do
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 $str = $botCheckIDs[$val & 31].$str;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 $val >>= 5;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 while ($val > 0);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 return $str;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
90 // Convert integer hash to integer value
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 function intHashToValue($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 global $botCheckIDs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 for ($val = 0, $i = 0; $i < strlen($hash); $i++)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 $val *= 32;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 $n = strpos($botCheckIDs, $hash[$i]);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 if ($n !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 $val += $n;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 return -2;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 return $val;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
107 // Split hash into parts
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 function splitHash($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 global $botCheckOPs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 return preg_split("/([".$botCheckOPs."])/", $hash, -1, PREG_SPLIT_DELIM_CAPTURE);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 function hashToCheckStr($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 global $botCheckOPs, $botCheckROPs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 $out = "";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 foreach (splitHash($hash) as $val)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 $i = strpos($botCheckOPs, $val);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 if ($i !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 $out .= " ".$botCheckROPs[$i]." ";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 $out .= intHashToValue($val);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 return $out;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 function hashToAnswer($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 eval("\$res = ".hashToCheckStr($hash).";");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 return $res;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137
1010
b3f579c33b08 Cosmetics, comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
138
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
139 // Check if user registration is available
103
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
140 stCheckRegistrationAvailable();
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
141
1010
b3f579c33b08 Cosmetics, comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
142
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 // Check if registration is enabled
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 if (!stChkSetting("allowRegister"))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 {
182
e227e6a3d46b Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
146 echo stGetSetting("registerNotEnabled");
103
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
147 }
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
148 else
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
149 if ($maxAttendeesHard > 0 && $numAttendees >= $maxAttendeesHard)
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
150 {
182
e227e6a3d46b Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
151 echo stGetSetting("registerLimitExceeded");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 if ($mode == "start")
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 {
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
156 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
157 // Show registration form
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
158 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
159 // Generate bot-check
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 $botCheckHash =
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 intValueToHash(rand(1,5)).
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162 $botCheckOPs[rand(0,2)].
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 intValueToHash(rand(1,5)).
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 $botCheckOPs[rand(0,2)].
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 intValueToHash(5 * rand(1,5));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
167 echo
1062
7135c7b18bb9 Add linefeed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1039
diff changeset
168 stGetSetting("registerPageBlurb")."\n".
771
cd8a29647c09 Change the API of stGetFormStart().
Matti Hamalainen <ccr@tnsp.org>
parents: 734
diff changeset
169 stGetFormStart("register", "register").
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
170 " ".stGetFormHiddenInput("mode", "check")."\n".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
171 " ".stGetFormHiddenInput("hash", $botCheckHash)."\n".
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
172 " <table class=\"register\">\n";
1039
42cf6048a594 Change some texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 1018
diff changeset
173 stPrintFormTextInput("Handle:", "(who you are)", 20, SET_LEN_USERNAME, "name");
42cf6048a594 Change some texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 1018
diff changeset
174 stPrintFormTextInput("Group(s):", "(duh)", 30, SET_LEN_GROUPS, "groups");
1014
87eda2e9023f Back out the stValidateRequestUserData() parameter change, use separate
Matti Hamalainen <ccr@tnsp.org>
parents: 1012
diff changeset
175 stPrintFormTextInput("E-mail:", stCheckRequireEmail() ? "(required)" : "", 30, SET_LEN_EMAIL, "email");
1039
42cf6048a594 Change some texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 1018
diff changeset
176 stPrintFormTextInput("Oneliner:", "(leave a message here)", 30, SET_LEN_ONELINER, "oneliner");
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
177 stPrintFormTextInput(hashToCheckStr($botCheckHash)." = ", "(I.Q. / robot check".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
178 //" [".hashToAnswer($botCheckHash)."]".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
179 ")", 20, 20, "botcheck", "autocomplete=\"off\"");
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
180 echo
195
e65b2392fc0e Change button title.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
181 " <tr><td colspan=\"2\"></td><td>".stGetFormSubmitInput("register", "Continue")."</td></tr>\n".
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
182 " </table>\n".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
183 "</form>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
185 echo stGetSetting("registerInfoText");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 else
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
188 if ($mode == "check" || $mode == "register")
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 {
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
190 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
191 // Check the registrant's details
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
192 //
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
193 stChkRequestItem("hash", $hash,
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
194 array(CHK_GTEQ, VT_STR, 0, "Invalid data."));
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
195
1014
87eda2e9023f Back out the stValidateRequestUserData() parameter change, use separate
Matti Hamalainen <ccr@tnsp.org>
parents: 1012
diff changeset
196 stValidateRequestUserData(FALSE, FALSE);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
197
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 $answer = stGetRequestItem("botcheck");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 if (hashToAnswer($hash) != intval($answer))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 stError("Incorrect answer to I.Q. / bot check.");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 if ($errorSet)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 {
1010
b3f579c33b08 Cosmetics, comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
204 // There were errors or missing data
1016
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
205 stPrintRegistrationErrors();
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
206 $errorSet = FALSE;
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 else
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
209 if ($mode == "register")
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 {
1010
b3f579c33b08 Cosmetics, comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
211 // Data ok, registration mode
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 714
diff changeset
212 $sql = stGetAttendeeRegistrationSQL();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 if (stExecSQL($sql) !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 {
183
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
215 echo stGetSetting("registerPostText");
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
216
594
dc53c26e6667 Bugfix.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
217 if (strlen(stGetRequestItem("email")) < 4)
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
218 echo stGetSetting("registerPostNoEmail");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 {
1018
aff236da33ba Improve error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 1016
diff changeset
222 stError("Oh noes! SQL error happenstance!");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224 }
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
225 else
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
226 {
1010
b3f579c33b08 Cosmetics, comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 1001
diff changeset
227 // Data ok, verify
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
228 echo
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
229 "<h1>Verify your information</h1>\n".
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
230 "<p>Is the following information correct?</p>\n".
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
231 "<table class=\"register\">\n";
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
232
1011
b7916209da83 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1010
diff changeset
233 foreach ($registerFormFields as $name => $title)
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
234 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
235 if ($title !== FALSE)
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
236 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
237 echo
656
c6df2ea4d5bf Use <th>-element instead of <td>.
Matti Hamalainen <ccr@tnsp.org>
parents: 646
diff changeset
238 " <tr><th class=\"".$name."\">".chentities($title).":</th>".
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
239 "<td>".chentities(stGetRequestItem($name))."</td></tr>\n";
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
240 }
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
241 }
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
242 echo "</table>\n";
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
243
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
244 stPrintFormData("Go back", "start", array("botcheck"));
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
245 stPrintFormData("Register", "register");
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
246 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 }
1016
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
248 else
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
249 stError("Invalid operation registration mode.");
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
250
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
251 if ($errorSet)
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
252 stPrintRegistrationErrors();
b7ebc845e740 Improve registration form error processing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1014
diff changeset
253
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 ?>