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 if (postRequestParameter('agree') == '!') {
65 registerOutputFailedMessage('HAVE_TO_AGREE');
68 if (postRequestParameter('email') == '!') {
69 registerOutputFailedMessage('ENTER_EMAIL');
70 setPostRequestParameter('email', '');
71 } elseif (postRequestParameter('email') == '?') {
72 registerOutputFailedMessage('EMAIL_ALREADY_DB');
73 setPostRequestParameter('email', '');
76 if (postRequestParameter('surname') == '!') {
77 registerOutputFailedMessage('ENTER_SURNAME');
78 setPostRequestParameter('surname', '');
81 if (postRequestParameter('family') == '!') {
82 registerOutputFailedMessage('ENTER_FAMILY');
83 setPostRequestParameter('family', '');
86 if ((postRequestParameter('pass1') == '!') && (postRequestParameter('pass2') == '!')) {
87 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
88 } elseif (postRequestParameter('pass1') == '!') {
89 registerOutputFailedMessage('ENTER_PASS1');
90 } elseif (postRequestParameter('pass2') == '!') {
91 registerOutputFailedMessage('ENTER_PASS2');
94 if ($GLOBALS['registration_short_password'] === true) {
95 registerOutputFailedMessage('SHORT_PASS', ': ' . getConfig('pass_len'));
98 if ($GLOBALS['registration_ip_timeout'] === true) {
99 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
102 if ((!empty($GLOBALS['register_selected_cats'])) && ($GLOBALS['register_selected_cats'] < getConfig('least_cats'))) {
103 registerOutputFailedMessage('', getMessage('CATS_LEAST'));
106 // Generate birthday selection
107 switch (getLanguage()) {
108 case 'de': // German date format
109 $content['birthday_selection'] = addSelectionBox('day', postRequestParameter('day')).addSelectionBox('month', postRequestParameter('month')).addSelectionBox('year', postRequestParameter('year'));
112 default: // Default is the US date format... :)
113 $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year'));
117 // Adds a table for the guests with all visible categories
118 $content['category_selection'] = registerGenerateCategoryTable('guest', true);
120 // Adds maximum receiveable mails list... :)
121 $content['max_receive_list'] = addMaxReceiveList('guest', '', true);
123 // Shall I display the refid or shall I make it editable?
124 if (getConfig('display_refid') == 'Y') {
125 // Load "hide" form template
126 $content['refid_content'] = loadTemplate('guest_register_refid_hide', true, determineReferalId());
128 // Load template to enter it
129 $content['refid_content'] = loadTemplate('guest_register_refid', true, determineReferalId());
132 // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
133 $content['header_content'] = loadTemplate('register_header', true);
136 $content['surname'] = SQL_ESCAPE(postRequestParameter('surname'));
137 $content['family'] = SQL_ESCAPE(postRequestParameter('family'));
138 $content['street_nr'] = SQL_ESCAPE(postRequestParameter('street_nr'));
139 $content['zip'] = '';
140 if (isPostRequestParameterSet('zip')) {
141 $content['zip'] = bigintval(postRequestParameter('zip'));
143 $content['city'] = SQL_ESCAPE(postRequestParameter('city'));
144 $content['email'] = SQL_ESCAPE(postRequestParameter('email'));
146 // Prepare country selection box
147 $OUT = "<select name=\"country_code\" class=\"guest_select\" size=\"1\">\n";
148 $whereStatement = "WHERE `is_active`='Y'";
149 if (isAdmin()) $whereStatement = '';
150 $OUT .= generateOptionList('countries', 'id', 'descr', postRequestParameter('country_code'), 'code', $whereStatement);
152 $content['country'] = $OUT;
154 // Set must-fillout fields
155 $content = runFilterChain('register_must_fillout', $content);
157 // Display registration form
158 loadTemplate('guest_register', false, $content);