A lot code refactured to newly introduces wrapper function isNicknameUsed()
[mailer.git] / inc / modules / guest / what-register.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/10/2003 *
4  * ===============                              Last change: 11/26/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-register.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Registration form                                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Anmeldeformular                                  *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
42         require($INC);
43 } elseif ((!EXT_IS_ACTIVE('register'))) {
44         addFatalMessage(__FILE__, __LINE__, generateExtensionInactiveNotInstalledMessage('register'));
45         return;
46 }
47
48 // Add description as navigation point
49 ADD_DESCR('guest', __FILE__);
50
51 global $DATA;
52
53 // Initialize variables
54 $isFailed = false; $SHORT_PASS = false; $cats = 0; $IP_TIMEOUT = false;
55
56 if (!isFormSent()) REQUEST_UNSET_POST('ok');
57
58 if (!REQUEST_ISSET_POST(('agree')))        REQUEST_SET_POST('agree'       , '');
59 if (!REQUEST_ISSET_POST(('addy')))         REQUEST_SET_POST('addy'        , '');
60 if (!REQUEST_ISSET_POST(('surname')))      REQUEST_SET_POST('surname'     , '');
61 if (!REQUEST_ISSET_POST(('family')))       REQUEST_SET_POST('family'      , '');
62 if (!REQUEST_ISSET_POST(('pass1')))        REQUEST_SET_POST('pass1'       , '');
63 if (!REQUEST_ISSET_POST(('pass2')))        REQUEST_SET_POST('pass2'       , '');
64 if (!REQUEST_ISSET_POST(('day')))          REQUEST_SET_POST('day'         , '');
65 if (!REQUEST_ISSET_POST(('month')))        REQUEST_SET_POST('month'       , '');
66 if (!REQUEST_ISSET_POST(('year')))         REQUEST_SET_POST('year'        , '');
67 if (!REQUEST_ISSET_POST(('max_mails')))    REQUEST_SET_POST('max_mails'   , '');
68 if (!REQUEST_ISSET_POST(('street_nr')))    REQUEST_SET_POST('street_nr'   , '');
69 if (!REQUEST_ISSET_POST('zip'))          REQUEST_SET_POST('zip'         , '');
70 if (!REQUEST_ISSET_POST(('city')))         REQUEST_SET_POST('city'        , '');
71 if (!REQUEST_ISSET_POST(('cntry')))        REQUEST_SET_POST('cntry'       , '');
72 if (!REQUEST_ISSET_POST(('country_code'))) REQUEST_SET_POST('country_code', '1');
73
74 // Default refid is zero
75 REQUEST_SET_POST('refid', 0);
76 if ($GLOBALS['refid'] > 0) {
77         // Test if the refid is valid
78         $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
79         array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__);
80
81         // Userid found?
82         //* DEBUG: */ die("refid={$GLOBALS['refid']}/numRows=".SQL_NUMROWS($result)."");
83         if (SQL_NUMROWS($result) == 0) {
84                 // Not found so we set your refid!
85                 REQUEST_SET_POST('refid', getConfig('def_refid'));
86                 setSession('refid', getConfig('def_refid'));
87         } else {
88                 // Use the refid here
89                 REQUEST_SET_POST('refid', $GLOBALS['refid']);
90         }
91 } // END - if
92
93 if (isFormSent()) {
94         // First we only check the submitted data then we continue... :)
95         //
96         // Did he agree to our Terms Of Usage?
97         if (REQUEST_POST('agree') != 'Y') {
98                 REQUEST_SET_POST('agree', '!');
99                 $isFailed = true;
100         } // END - if
101
102         // Did he enter a valid email address? (we really don't care about
103         // that, he has to click on a confirmation link :P )
104         if ((!REQUEST_ISSET_POST(('addy'))) || (!isEmailValid(REQUEST_POST('addy')))) {
105                 REQUEST_SET_POST('addy', '!');
106                 $isFailed = true;
107         } // END - if
108
109         // And what about surname and family's name?
110         if (!REQUEST_ISSET_POST(('surname'))) {
111                 REQUEST_SET_POST('surname', '!');
112                 $isFailed = true;
113         } // END - if
114         if (!REQUEST_ISSET_POST(('family'))) {
115                 REQUEST_SET_POST('family', '!');
116                 $isFailed = true;
117         } // END - if
118
119         // Check for required fields
120         if ($isFailed === false) $isFailed = REGISTER_CHECK_REQUIRED_FIELDS(REQUEST_POST_ARRAY());
121
122         // Did he enter his password twice?
123         if (((!REQUEST_ISSET_POST(('pass1'))) || (!REQUEST_ISSET_POST(('pass2')))) || ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2'))))) {
124                 if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) && (REQUEST_ISSET_POST(('pass1'))) && (REQUEST_ISSET_POST(('pass2')))) {
125                         REQUEST_SET_POST('pass1', '!');
126                         REQUEST_SET_POST('pass2', '!');
127                 } else {
128                         if (!REQUEST_ISSET_POST(('pass1'))) { REQUEST_SET_POST('pass1', '!'); } else { REQUEST_SET_POST('pass1', ''); }
129                         if (!REQUEST_ISSET_POST(('pass2'))) { REQUEST_SET_POST('pass2', '!'); } else { REQUEST_SET_POST('pass2', ''); }
130                 }
131                 $isFailed = true;
132         } // END - if
133
134         // Is the password long enouth?
135         if ((strlen(REQUEST_POST('pass1')) < getConfig('pass_len')) && ($isFailed === false)) {
136                 $SHORT_PASS = true;
137                 $isFailed = true;
138         } // END - if
139
140         // No admin? Admins can always register!
141         if (!IS_ADMIN()) {
142                 // Do this check only when no admin is logged in
143                 foreach (REQUEST_POST('cat') as $id => $answer) {
144                         if ($answer == 'Y') $cats++;
145                 } // END - foreach
146
147                 if ($cats < getConfig('least_cats')) {
148                         // ... nope!
149                         $isFailed = true;
150                 } // END - if
151         } // END - if
152
153         if ((REQUEST_POST('addy') != '!') && (getConfig('check_double_email') == 'Y')) {
154                 // Does the email address already exists in our database?
155                 $CHK = isEmailTaken(REQUEST_POST('addy'));
156                 if ($CHK === true) {
157                         REQUEST_SET_POST('addy', '?');
158                         $isFailed = true;
159                 } // END - if
160         } // END - if
161
162         // Check for IP timeout?
163         if (getConfig('ip_timeout') > 0) {
164                 // Check his IP number
165                 $result = SQL_QUERY_ESC("SELECT joined, last_update FROM `{!_MYSQL_PREFIX!}_user_data` WHERE REMOTE_ADDR='%s' AND (joined > (UNIX_TIMESTAMP() - %s) OR last_update > (UNIX_TIMESTAMP() - %s)) LIMIT 1",
166                 array(detectRemoteAddr(), getConfig('ip_timeout'), getConfig('ip_timeout')), __FILE__, __LINE__);
167                 if (SQL_NUMROWS($result) == 1) {
168                         // Same IP in timeout range and different email address entered... Eat this, faker! ;-)
169                         // But admins are allowed to fake their own exchange service.
170                         $IP_TIMEOUT = true;
171                         $isFailed = true;
172                 } // END - if
173         } // END - if
174
175         // Free memory
176         SQL_FREERESULT($result);
177 }
178
179 if ((isFormSent()) && (($isFailed === false) || (IS_ADMIN()))) {
180         // Prepapre month and day of birth
181         if (strlen(REQUEST_POST('day'))   == 1) REQUEST_SET_POST('day'  , '0'.REQUEST_POST('day'));
182         if (strlen(REQUEST_POST('month')) == 1) REQUEST_SET_POST('month', '0'.REQUEST_POST('month'));
183
184         // Get total ...
185         // ... confirmed, ...
186         $confirmedUsers   = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
187         // ... unconfirmed ...
188         $unconfirmedUsers = GET_TOTAL_DATA('UNCONFIRMED', 'user_data', 'userid', 'status', true);
189         // ... and locked users!
190         $lockedUsers      = GET_TOTAL_DATA('LOCKED', 'user_data', 'userid', 'status', true);
191
192         // Generate hash which will be inserted into confirmation mail
193         $hash = generateHash(sha1($confirmedUsers.getConfig('ENCRYPT_SEPERATOR').$unconfirmedUsers.getConfig('ENCRYPT_SEPERATOR').$lockedUsers.getConfig('ENCRYPT_SEPERATOR').REQUEST_POST('month') . '-'.REQUEST_POST('day') . '-'.REQUEST_POST('year').getConfig('ENCRYPT_SEPERATOR').getenv('SERVER_NAME').getConfig('ENCRYPT_SEPERATOR').detectRemoteAddr().getConfig('ENCRYPT_SEPERATOR').detectUserAgent().'/'.getConfig('SITE_KEY') . '/'.getConfig('DATE_KEY') . '/'.constant('RAND_NUMBER')));
194
195         // Add design when extension sql_patches is v0.2.7 or greater
196         // @TODO Rewrite these all to a single filter
197         $ADD1 = ''; $ADD2 = '';
198         if (GET_EXT_VERSION('theme') >= '0.0.8') {
199                 // Okay, add design here
200                 $ADD1 = ", `curr_theme`";
201                 $ADD2 = ", '".getCurrentTheme()."'";
202         } // END - if
203
204         // Check if I shall disable sending mail to newly registered members out about active/begging rallye
205         //
206         // First comes first: begging rallye
207         if (GET_EXT_VERSION('beg') >= '0.1.7') {
208                 // Okay, shall I disable now?
209                 if (getConfig('beg_new_mem_notify') != 'Y') {
210                         $ADD1 .= ", `beg_ral_notify`, `beg_ral_en_notify`";
211                         $ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()";
212                 } // END - if
213         } // END - if
214
215         // Second: active rallye
216         if (GET_EXT_VERSION('bonus') >= '0.7.7') {
217                 // Okay, shall I disable now?
218                 if (getConfig('bonus_new_mem_notify') != 'Y') {
219                         $ADD1 .= ", `bonus_ral_notify`, `bonus_ral_en_notify`";
220                         $ADD2 .= ", UNIX_TIMESTAMP(), UNIX_TIMESTAMP()";
221                 } // END - if
222         } // END - if
223
224         // Write user data to table
225         if (EXT_IS_ACTIVE('country')) {
226                 // Save with new selectable country code
227                 $countryRow = "`country_code`";
228                 $countryData = bigintval(REQUEST_POST('country_code'));
229         } else {
230                 // Old way with enterable two-char-code
231                 $countryRow = "`country`";
232                 $countryData = substr(REQUEST_POST('cntry'), 0, 2);
233         }
234
235         //////////////////////////////
236         // Create user's account... //
237         //////////////////////////////
238         //
239         SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_data` (gender, surname, family, street_nr,%s, zip, city, email, birth_day, birth_month, birth_year, password, max_mails, receive_mails, refid, status, user_hash, REMOTE_ADDR, joined, last_update".$ADD1.")
240 VALUES ('%s','%s','%s','%s','%s',%s,'%s','%s',%s, %s,%s,'%s',%s, %s,'%s','UNCONFIRMED','%s','%s', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()".$ADD2.")",
241         array(
242         $countryRow,
243         substr(REQUEST_POST('gender'), 0, 1),
244         REQUEST_POST('surname'),
245         REQUEST_POST('family'),
246         REQUEST_POST('street_nr'),
247         $countryData,
248         bigintval(REQUEST_POST('zip')),
249         REQUEST_POST('city'),
250         REQUEST_POST('addy'),
251         bigintval(REQUEST_POST('day')),
252         bigintval(REQUEST_POST('month')),
253         bigintval(REQUEST_POST('year')),
254         generateHash(REQUEST_POST('pass1')),
255         bigintval(REQUEST_POST('max_mails')),
256         bigintval(REQUEST_POST('max_mails')),
257         bigintval(REQUEST_POST('refid')),
258         $hash,
259         detectRemoteAddr(),
260         ), __FILE__, __LINE__);
261
262         // Get his userid
263         $userid = SQL_INSERTID();
264
265         // Did this work?
266         if ($userid == 0) {
267                 // Something bad happened!
268                 LOAD_TEMPLATE('admin_settings_saved', false, getMessage('USER_NOT_REGISTERED'));
269                 return;
270         } // END - if
271
272         // Is the refback extension there?
273         // @TODO Rewrite this to a filter
274         if (EXT_IS_ACTIVE('refback')) {
275                 // Update refback table
276                 updateRefbackTable($userid);
277         } // END - if
278
279         // Write his welcome-points
280         $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s AND ref_depth=0 LIMIT 1",
281         array(bigintval($userid)), __FILE__, __LINE__);
282         if (SQL_NUMROWS($result) == 0) {
283                 // Add only when the line was not found (maybe some more secure?)
284                 $locked = "points";
285                 if (getConfig('ref_payout') > 0) $locked = "locked_points"; // Pay him later. First he has to confirm some mails!
286                 SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_points` (userid, ref_depth, ".$locked.") VALUES (%s,0,'%s')",
287                 array(bigintval($userid), getConfig('points_register')), __FILE__, __LINE__);
288
289                 // Update mediadata as well
290                 if ((GET_EXT_VERSION('mediadata') >= '0.0.4') && ($locked == "points")) {
291                         // Update database
292                         MEDIA_UPDATE_ENTRY(array('total_points'), 'add', getConfig('points_register'));
293                 } // END - if
294         } // END - if
295
296         // Write catgories
297         if ((is_array(REQUEST_POST('cat'))) && (count(REQUEST_POST('cat')))) {
298                 foreach (REQUEST_POST('cat') as $cat => $joined) {
299                         if ($joined == 'Y') {
300                                 // Insert category entry
301                                 SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_user_cats` (userid, cat_id) VALUES (%s, %s)",
302                                 array(bigintval($userid), bigintval($cat)), __FILE__, __LINE__);
303                         } // END - if
304                 } // END - foreach
305         } // END - if
306
307         // Rewrite gender
308         $gender = translateGender(REQUEST_POST('gender'));
309
310         // ... rewrite a zero referal ID to the main title
311         if (REQUEST_POST('refid') == '0') REQUEST_SET_POST('refid', constant('MAIN_TITLE'));
312
313         // Is ZIP code set?
314         if (REQUEST_ISSET_POST('zip')) {
315                 // Prepare data array for the email template
316                 // Start with the gender...
317                 $DATA = array(
318                         'hash'    => $hash,
319                         'uid'     => $userid,
320                         'gender'  => $gender,
321                         'surname' => SQL_ESCAPE(REQUEST_POST('surname')),
322                         'family'  => SQL_ESCAPE(REQUEST_POST('family')),
323                         'email'   => SQL_ESCAPE(REQUEST_POST('addy')),
324                         'street'  => SQL_ESCAPE(REQUEST_POST('street_nr')),
325                         'city'    => SQL_ESCAPE(REQUEST_POST('city')),
326                         'zip'     => bigintval(REQUEST_POST('zip')),
327                         'country' => $countryData,
328                         'refid'   => SQL_ESCAPE(REQUEST_POST('refid')),
329                         'pass'    => SQL_ESCAPE(REQUEST_POST('pass1')),
330                 );
331         } else {
332                 // No ZIP code entered
333                 $DATA = array(
334                         'hash'    => $hash,
335                         'uid'     => $userid,
336                         'gender'  => $gender,
337                         'surname' => SQL_ESCAPE(REQUEST_POST('surname')),
338                         'family'  => SQL_ESCAPE(REQUEST_POST('family')),
339                         'email'   => SQL_ESCAPE(REQUEST_POST('addy')),
340                         'street'  => SQL_ESCAPE(REQUEST_POST('street_nr')),
341                         'city'    => SQL_ESCAPE(REQUEST_POST('city')),
342                         'zip'     => "",
343                         'country' => $countryData,
344                         'refid'   => SQL_ESCAPE(REQUEST_POST('refid')),
345                         'pass'    => SQL_ESCAPE(REQUEST_POST('pass1')),
346                 );
347         }
348
349         // Continue with birthday...
350         switch (getLanguage())
351         {
352                 case 'de':
353                         $DATA['birthday'] = bigintval(REQUEST_POST('day')).'.'.bigintval(REQUEST_POST('month')).'.'.bigintval(REQUEST_POST('year'));
354                         break;
355
356                 default:
357                         $DATA['birthday'] = bigintval(REQUEST_POST('month')).'/'.bigintval(REQUEST_POST('day')).'/'.bigintval(REQUEST_POST('year'));
358                         break;
359         }
360
361         // Display information to the user that he got mail and send it away
362         $msg_guest = LOAD_EMAIL_TEMPLATE('register-member', $DATA, $userid);
363
364         // Send mail to user (confirmation link!)
365         $EMAIL = $DATA['email'];
366         sendEmail ($DATA['email'], getMessage('GUEST_CONFIRM_LINK'), $msg_guest);
367         $DATA['email'] = $EMAIL;
368
369         // Send mail to admin
370         sendAdminNotification(getMessage('ADMIN_NEW_ACCOUNT'), 'register-admin', $DATA, $userid);
371
372         // Output success registration
373         LOAD_TEMPLATE('admin_settings_saved', false, getMessage('REGISTRATION_DONE'));
374 } else {
375         if (REQUEST_POST('agree') == '!') {
376                 registerOutputFailedMessage('HAVE_TO_AGREE');
377         } // END - if
378
379         if (REQUEST_POST('addy') == '!') {
380                 registerOutputFailedMessage('ENTER_EMAIL');
381                 REQUEST_SET_POST('addy', '');
382         } elseif (REQUEST_POST('addy') == '?') {
383                 registerOutputFailedMessage('EMAIL_ALREADY_DB');
384                 REQUEST_SET_POST('addy', '');
385         }
386
387         if (REQUEST_POST('surname') == '!') {
388                 registerOutputFailedMessage('ENTER_SURNAME');
389                 REQUEST_SET_POST('surname', '');
390         } // END - if
391
392         if (REQUEST_POST('family') == '!') {
393                 registerOutputFailedMessage('ENTER_FAMILY');
394                 REQUEST_SET_POST('family', '');
395         } // END - if
396
397         if ((REQUEST_POST('pass1') == '!') && (REQUEST_POST('pass2') == '!')) {
398                 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
399         } elseif (REQUEST_POST('pass1') == '!') {
400                 registerOutputFailedMessage('ENTER_PASS1');
401         } elseif (REQUEST_POST('pass2') == '!') {
402                 registerOutputFailedMessage('ENTER_PASS2');
403         }
404
405         if ($SHORT_PASS === true) {
406                 registerOutputFailedMessage('SHORT_PASS', ": ".getConfig('pass_len'));
407         } // END - if
408
409         if ($IP_TIMEOUT === true) {
410                 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
411         } // END - if
412
413         if ((!empty($cats)) && ($cats < getConfig('least_cats'))) {
414                 registerOutputFailedMessage(sprintf(getMessage('CATS_LEAST'), getConfig('least_cats')));
415         } // END - if
416
417         // Generate birthday selection
418         switch (getLanguage())
419         {
420                 case 'de': // German date format
421                         define('BIRTHDAY_SELECTION', ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('year', REQUEST_POST('year')));
422                         break;
423
424                 default: // Default is the US date format... :)
425                         define('BIRTHDAY_SELECTION', ADD_SELECTION('month', REQUEST_POST('month')).ADD_SELECTION('day', REQUEST_POST('day')).ADD_SELECTION('year', REQUEST_POST('year')));
426                         break;
427         }
428
429         // Adds a table for the guests with all visible categories
430         define('CATEGORY_SELECTION', registerGenerateCategoryTable('guest', true));
431
432         // Adds maximum receiveable mails list... :)
433         define('MAX_RECEIVE_LIST', addMaxReceiveList('guest', '', true));
434
435         // Shall I display the refid or shall I make it editable?
436         if (getConfig('display_refid') == 'Y') {
437                 // Load "hide" form template
438                 define('REFID_CONTENT', LOAD_TEMPLATE('guest_register_refid_hide', true, $GLOBALS['refid']));
439         } else {
440                 // Load template to enter it
441                 define('REFID_CONTENT', LOAD_TEMPLATE('guest_register_refid', true, $GLOBALS['refid']));
442         }
443
444         // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
445         define('REGISTER_HEADER_CONTENT', LOAD_TEMPLATE('register_header', true));
446
447         // Please select at least x categories
448         define('LEAST_CATS_VALUE', getConfig('least_cats'));
449
450         // Other values
451         define('__SURNAME', SQL_ESCAPE(REQUEST_POST('surname')));
452         define('__FAMILY',  SQL_ESCAPE(REQUEST_POST('family')));
453         define('__STREET',  SQL_ESCAPE(REQUEST_POST('street_nr')));
454         define('__COUNTRY', SQL_ESCAPE(REQUEST_POST('cntry')));
455         if ((REQUEST_ISSET_POST('zip')) && (REQUEST_POST('zip') != '')) {
456                 define('__ZIP', bigintval(REQUEST_POST('zip')));
457         } else {
458                 define('__ZIP', '');
459         }
460         define('__CITY',    SQL_ESCAPE(REQUEST_POST('city')));
461         define('__ADDY',    SQL_ESCAPE(REQUEST_POST('addy')));
462
463         // Shall I add a counrty selection box or the old input box?
464         if (EXT_IS_ACTIVE('country')) {
465                 // New variant, good!
466                 $OUT  = "<select name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
467                 $whereStatement = "WHERE is_active='Y'";
468                 if (IS_ADMIN()) $whereStatement = '';
469                 $OUT .= generateOptionList('countries', 'id', 'descr', REQUEST_POST('country_code'), 'code', $whereStatement);
470                 $OUT .= "</select>";
471                 define('__COUNTRY_CONTENT', $OUT);
472         } else {
473                 // Old out-dated variant
474                 define('__COUNTRY_CONTENT', "<input type=\"text\" name=\"cntry\" class=\"guest_normal\" size=\"2\" maxlength=\"3\" value=\"{!__COUNTRY!}\" />");
475         }
476
477         // Set MUST_??? constants
478         if ((EXT_IS_ACTIVE('register')) && (GET_EXT_VERSION('register') > '0.0')) registerMustFillout();
479
480         // Display registration form
481         LOAD_TEMPLATE('guest_register');
482 }
483
484 //
485 ?>