2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 10/10/2003 *
4 * =================== Last change: 11/26/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-register.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Registration form *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Anmeldeformular *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
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. *
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. *
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, *
37 ************************************************************************/
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
44 // Add description as navigation point
45 addMenuDescription('guest', __FILE__);
47 if (!isExtensionActive('register')) {
48 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('register'));
50 } elseif (!isExtensionActive('country')) {
51 loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('country'));
55 // Is the form sent and all went fine?
56 //* DEBUG: */ print intval(isFormSent()) . '/' . intval(isRegistrationDataComplete()) . '/' . intval(isAdmin()) . '<br />';
57 if ((isFormSent()) && (isRegistrationDataComplete())) {
58 // Do the registration here
61 // Output success registration
62 loadTemplate('admin_settings_saved', false, getMessage('REGISTRATION_DONE'));
64 // Do this only if form is sent
66 if (postRequestParameter('agree') == '!') {
67 registerOutputFailedMessage('HAVE_TO_AGREE');
70 if (postRequestParameter('email') == '!') {
71 registerOutputFailedMessage('ENTER_EMAIL');
72 setPostRequestParameter('email', '');
73 } elseif (postRequestParameter('email') == '?') {
74 registerOutputFailedMessage('EMAIL_ALREADY_DB');
75 setPostRequestParameter('email', '');
78 if (postRequestParameter('surname') == '!') {
79 registerOutputFailedMessage('ENTER_SURNAME');
80 setPostRequestParameter('surname', '');
83 if (postRequestParameter('family') == '!') {
84 registerOutputFailedMessage('ENTER_FAMILY');
85 setPostRequestParameter('family', '');
88 if ((postRequestParameter('pass1') == '!') && (postRequestParameter('pass2') == '!')) {
89 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
90 } elseif (postRequestParameter('pass1') == '!') {
91 registerOutputFailedMessage('ENTER_PASS1');
92 } elseif (postRequestParameter('pass2') == '!') {
93 registerOutputFailedMessage('ENTER_PASS2');
96 if ((isset($GLOBALS['registration_short_password'])) && ($GLOBALS['registration_short_password'] === true)) {
97 registerOutputFailedMessage('SHORT_PASS', ': ' . getConfig('pass_len'));
100 if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === true)) {
101 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
104 if ((!empty($GLOBALS['register_selected_cats'])) && ($GLOBALS['register_selected_cats'] < getConfig('least_cats'))) {
105 registerOutputFailedMessage('', getMessage('CATS_LEAST'));
109 // Generate birthday selection
110 switch (getLanguage()) {
111 case 'de': // German date format
112 $content['birthday_selection'] = addSelectionBox('day', postRequestParameter('day')).addSelectionBox('month', postRequestParameter('month')).addSelectionBox('year', postRequestParameter('year'));
115 default: // Default is the US date format... :)
116 $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year'));
120 // Adds a table for the guests with all visible categories
121 $content['category_selection'] = registerGenerateCategoryTable('guest', true);
123 // Adds maximum receiveable mails list... :)
124 $content['max_receive_list'] = addMaxReceiveList('guest', '', true);
126 // Shall I display the refid or shall I make it editable?
127 if (getConfig('display_refid') == 'Y') {
128 // Load "hide" form template
129 $content['refid_content'] = loadTemplate('guest_register_refid_hide', true, determineReferalId());
131 // Load template to enter it
132 $content['refid_content'] = loadTemplate('guest_register_refid', true, determineReferalId());
135 // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
136 $content['header_content'] = loadTemplate('register_header', true);
139 $content['surname'] = SQL_ESCAPE(postRequestParameter('surname'));
140 $content['family'] = SQL_ESCAPE(postRequestParameter('family'));
141 $content['street_nr'] = SQL_ESCAPE(postRequestParameter('street_nr'));
142 $content['zip'] = '';
143 if (isPostRequestParameterSet('zip')) {
144 $content['zip'] = bigintval(postRequestParameter('zip'));
146 $content['city'] = SQL_ESCAPE(postRequestParameter('city'));
147 $content['email'] = SQL_ESCAPE(postRequestParameter('email'));
149 // Prepare country selection box
150 $OUT = "<select name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
151 $whereStatement = "WHERE `is_active`='Y'";
152 if (isAdmin()) $whereStatement = '';
153 $OUT .= generateOptionList('countries', 'id', 'descr', postRequestParameter('country_code'), 'code', $whereStatement);
155 $content['country'] = $OUT;
157 // Set must-fillout fields
158 $content = runFilterChain('register_must_fillout', $content);
160 // Display registration form
161 loadTemplate('guest_register', false, $content);