annotate pages/register.inc.php @ 734:26a168d3390f

Move functions into a more appropriate file.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Nov 2014 02:08:40 +0200
parents e7fbcf4190e6
children cd8a29647c09
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
565
ed2247111fdd Bump copyright years.
Matti Hamalainen <ccr@tnsp.org>
parents: 514
diff changeset
5 // (C) Copyright 2012-2014 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
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
14 $formFields = array(
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
15 "name" => "Name",
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
16 "groups" => "Group(s)",
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
17 "email" => "E-mail",
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
18 "oneliner" => "Oneliner",
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
19 "hash" => FALSE,
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
20 "botcheck" => FALSE,
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
21 );
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
23
734
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
24 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
25 {
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
26 echo " <tr><th>".chentities($text1)."</th><td>".
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
27 stGetFormTextInput($size, $len, $name, "", "", stGetRequestItem($name), $extra).
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
28 "</td><td>".chentities($text2)."</td></tr>\n";
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
29 }
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 function stPrintFormHiddenInput($name, $value)
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
33 {
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
34 echo " ".stGetFormHiddenInput($name, $value)."\n";
26a168d3390f Move functions into a more appropriate file.
Matti Hamalainen <ccr@tnsp.org>
parents: 716
diff changeset
35 }
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
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
38 function stPrintFormData($button, $mode = "start", $exclude = array())
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 {
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
40 global $formFields;
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
41
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 echo
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
43 stGetFormStart("register").
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
44 " ".stGetFormSubmitInput("continue", $button)."\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 stPrintFormHiddenInput("mode", $mode);
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
47
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
48 foreach ($formFields as $name => $title)
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
49 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
50 if (!in_array($name, $exclude))
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
51 stPrintFormHiddenInput($name, stGetRequestItem($name));
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
52 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 echo "</form>\n";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
58 // Convert integer value to hash code
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 function intValueToHash($val)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 global $botCheckIDs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 $str = "";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 do
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65 $str = $botCheckIDs[$val & 31].$str;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 $val >>= 5;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 while ($val > 0);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 return $str;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
73 // Convert integer hash to integer value
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 function intHashToValue($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 global $botCheckIDs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 for ($val = 0, $i = 0; $i < strlen($hash); $i++)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 $val *= 32;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 $n = strpos($botCheckIDs, $hash[$i]);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 if ($n !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 $val += $n;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 return -2;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 return $val;
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 // Split hash into parts
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 function splitHash($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 $botCheckOPs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 return preg_split("/([".$botCheckOPs."])/", $hash, -1, PREG_SPLIT_DELIM_CAPTURE);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 function hashToCheckStr($hash)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 {
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 global $botCheckOPs, $botCheckROPs;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 $out = "";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 foreach (splitHash($hash) as $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 $i = strpos($botCheckOPs, $val);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 if ($i !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 $out .= " ".$botCheckROPs[$i]." ";
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109 $out .= intHashToValue($val);
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 return $out;
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 hashToAnswer($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 eval("\$res = ".hashToCheckStr($hash).";");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 return $res;
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
121 // 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
122 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
123
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 // Check if registration is enabled
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 if (!stChkSetting("allowRegister"))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 {
182
e227e6a3d46b Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
127 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
128 }
c6b9041078ec Add hard limit option for attendees, and add feature of using "0" to disable
Matti Hamalainen <ccr@tnsp.org>
parents: 48
diff changeset
129 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
130 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
131 {
182
e227e6a3d46b Move some texts to settings.
Matti Hamalainen <ccr@tnsp.org>
parents: 138
diff changeset
132 echo stGetSetting("registerLimitExceeded");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 if ($mode == "start")
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 {
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
137 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
138 // Show registration form
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
139 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
140 // Generate bot-check
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 $botCheckHash =
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 intValueToHash(rand(1,5)).
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 $botCheckOPs[rand(0,2)].
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 intValueToHash(rand(1,5)).
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 $botCheckOPs[rand(0,2)].
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 intValueToHash(5 * rand(1,5));
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
148 echo
659
1702a5e0b9c3 Add new settings for certain HTML pieces.
Matti Hamalainen <ccr@tnsp.org>
parents: 656
diff changeset
149 stGetSetting("registerPageBlurb").
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
150 stGetFormStart("register").
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
151 " ".stGetFormHiddenInput("mode", "check")."\n".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
152 " ".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
153 " <table class=\"register\">\n";
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
154 stPrintFormTextInput("Handle:", "(elite)", 20, SET_LEN_USERNAME, "name");
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
155 stPrintFormTextInput("Group(s):", "(elite crew^supahmen)", 30, SET_LEN_GROUPS, "groups");
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
156 stPrintFormTextInput("E-mail:", "(to be informed of location etc)", 30, SET_LEN_EMAIL, "email");
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
157 stPrintFormTextInput("Oneliner:", "(whatever)", 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
158 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
159 //" [".hashToAnswer($botCheckHash)."]".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
160 ")", 20, 20, "botcheck", "autocomplete=\"off\"");
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
161 echo
195
e65b2392fc0e Change button title.
Matti Hamalainen <ccr@tnsp.org>
parents: 191
diff changeset
162 " <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
163 " </table>\n".
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
164 "</form>\n";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165
26
7be3f8cf1f7a Lots of cleanups, preparing for adding entry submission support.
Matti Hamalainen <ccr@tnsp.org>
parents: 16
diff changeset
166 echo stGetSetting("registerInfoText");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 else
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
169 if ($mode == "check" || $mode == "register")
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 {
138
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
171 //
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
172 // Check the registrant's details
e04f6e3c04f7 Add some comments.
Matti Hamalainen <ccr@tnsp.org>
parents: 136
diff changeset
173 //
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
174 stChkRequestItem("hash", $hash,
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
175 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
176
646
2eeca16e9c96 Improve attendee adding/updating data validation.
Matti Hamalainen <ccr@tnsp.org>
parents: 594
diff changeset
177 stValidateRequestUserData(FALSE, FALSE);
184
1b30c2107e5b Add function for validating input with different definable conditions. Use
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
178
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 $answer = stGetRequestItem("botcheck");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 if (hashToAnswer($hash) != intval($answer))
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 stError("Incorrect answer to I.Q. / bot check.");
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 if ($errorSet)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184 {
183
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
185 echo
714
014244a01d17 Use header tag instead of para.
Matti Hamalainen <ccr@tnsp.org>
parents: 659
diff changeset
186 "<h1>Following errors occured:</h1>\n".
210
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
187 "<ul>\n";
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
188
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
189 foreach ($errorMsgs as $msg)
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
190 echo " <li>".$msg."</li>\n";
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
191
cafc05949a19 Work on error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 207
diff changeset
192 echo "</ul>\n";
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
193 stPrintFormData("Go back", "start", array("botcheck"));
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 else
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
196 if ($mode == "register")
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 {
716
e7fbcf4190e6 Add registration host.
Matti Hamalainen <ccr@tnsp.org>
parents: 714
diff changeset
198 $sql = stGetAttendeeRegistrationSQL();
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 if (stExecSQL($sql) !== FALSE)
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 {
183
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
201 echo stGetSetting("registerPostText");
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
202
594
dc53c26e6667 Bugfix.
Matti Hamalainen <ccr@tnsp.org>
parents: 571
diff changeset
203 if (strlen(stGetRequestItem("email")) < 4)
16
6da681d1f62a Moar work.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
204 echo stGetSetting("registerPostNoEmail");
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206 else
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 {
183
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
208 echo
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
209 "<h1>An error occured.</h1>\n".
320d6b68062b Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 182
diff changeset
210 "<p>Oh noes! SQL error happenstance!</p>";
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 }
191
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
213 else
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
214 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
215 echo
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
216 "<h1>Verify your information</h1>\n".
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
217 "<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
218 "<table class=\"register\">\n";
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
219
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
220 foreach ($formFields as $name => $title)
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
221 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
222 if ($title !== FALSE)
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
223 {
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
224 echo
656
c6df2ea4d5bf Use <th>-element instead of <td>.
Matti Hamalainen <ccr@tnsp.org>
parents: 646
diff changeset
225 " <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
226 "<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
227 }
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
228 }
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
229 echo "</table>\n";
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
230
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
231 stPrintFormData("Go back", "start", array("botcheck"));
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
232 stPrintFormData("Register", "register");
988e0ab2b77e Improve registration process by adding information verification phase.
Matti Hamalainen <ccr@tnsp.org>
parents: 188
diff changeset
233 }
0
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 }
8019b357cc03 Initial import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 ?>