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 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://www.mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
43 // Add description as navigation point
44 addYouAreHereLink('guest', __FILE__);
46 if (!isExtensionActive('register')) {
47 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=register%}');
49 } elseif (!isExtensionActive('country')) {
50 displayMessage('{%pipe,generateExtensionInactiveNotInstalledMessage=country%}');
54 // Is the form sent and all went fine?
55 //* DEBUG: */ debugOutput('isFormSent=' . intval(isFormSent()) . ',isRegistrationDataComplete=' . intval(isRegistrationDataComplete()) . ',isAdmin=' . intval(isAdmin()));
56 if ((isFormSent()) && (isRegistrationDataComplete())) {
57 // Do the registration here
60 // Output success registration
61 displayMessage('{--REGISTRATION_DONE--}');
63 // Do this only if form is sent
65 if (postRequestParameter('agree') == '!') {
66 registerOutputFailedMessage('HAVE_TO_AGREE');
69 if (postRequestParameter('email') == '!') {
70 registerOutputFailedMessage('ENTER_EMAIL');
71 setPostRequestParameter('email', '');
72 } elseif (postRequestParameter('email') == '?') {
73 registerOutputFailedMessage('GUEST_EMAIL_ALREADY_DB');
74 setPostRequestParameter('email', '');
77 if (postRequestParameter('surname') == '!') {
78 registerOutputFailedMessage('ENTER_SURNAME');
79 setPostRequestParameter('surname', '');
82 if (postRequestParameter('family') == '!') {
83 registerOutputFailedMessage('ENTER_FAMILY');
84 setPostRequestParameter('family', '');
87 if ((postRequestParameter('pass1') == '!') && (postRequestParameter('pass2') == '!')) {
88 registerOutputFailedMessage('ENTER_BOTH_PASSWORDS');
89 } elseif (postRequestParameter('pass1') == '!') {
90 registerOutputFailedMessage('ENTER_PASS1');
91 } elseif (postRequestParameter('pass2') == '!') {
92 registerOutputFailedMessage('ENTER_PASS2');
95 if ((isset($GLOBALS['registration_short_password'])) && ($GLOBALS['registration_short_password'] === true)) {
96 registerOutputFailedMessage('GUEST_SHORT_PASS', ': ' . getPassLen());
99 if ((isset($GLOBALS['registration_ip_timeout'])) && ($GLOBALS['registration_ip_timeout'] === true)) {
100 registerOutputFailedMessage('REMOTE_ADDR_TIMEOUT');
103 if ((!empty($GLOBALS['registration_selected_cats'])) && ($GLOBALS['registration_selected_cats'] < getLeastCats())) {
104 registerOutputFailedMessage('', '{--CHOOSE_MORE_CATEGORIES--}');
108 // Generate birthday selection
109 switch (getLanguage()) {
110 case 'de': // German date format
111 $content['birthday_selection'] = addSelectionBox('day', postRequestParameter('day')).addSelectionBox('month', postRequestParameter('month')).addSelectionBox('year', postRequestParameter('year'));
114 default: // Default is the US date format... :)
115 $content['birthday_selection'] = addSelectionBox('month', postRequestParameter('month')).addSelectionBox('day', postRequestParameter('day')).addSelectionBox('year', postRequestParameter('year'));
119 // Adds a table for the guests with all visible categories
120 $content['category_selection'] = registerGenerateCategoryTable('guest', true);
122 // Adds maximum receiveable mails list... :)
123 $content['max_receive_list'] = addMaxReceiveList('guest', '', true);
125 // Shall I display the refid or shall I make it editable?
126 if (isDisplayRefidEnabled()) {
127 // Load "hide" form template
128 $content['refid_content'] = loadTemplate('guest_register_refid_hide', true);
130 // Load template to enter it
131 $content['refid_content'] = loadTemplate('guest_register_refid', true);
134 // You may want to modify the register_header.tpl.xx file and not this script when you add your scripts etc. :-)
135 $content['header_content'] = loadTemplate('register_header', true);
137 // ZIP codes are numerical values
138 $content['zip'] = '';
139 if ((isPostRequestParameterSet('zip')) && (postRequestParameter('zip') > 0)) {
140 $content['zip'] = bigintval(postRequestParameter('zip'));
144 foreach (array('gender', 'surname', 'family', 'street_nr', 'city', 'email') as $entry) {
145 $content[$entry] = SQL_ESCAPE(postRequestParameter($entry));
148 // The admin may see all
149 $whereStatement = "WHERE `is_active`='Y'";
151 $whereStatement = '';
154 // Prepare country selection box
155 $OUT = '<select name="country_code" class="form_select" size="1">';
156 $OUT .= generateOptionList('countries', 'id', 'descr', postRequestParameter('country_code'), 'code', $whereStatement);
158 $content['country'] = $OUT;
160 // Set must-fillout fields
161 $content = runFilterChain('register_must_fillout', $content);
163 // Display registration form
164 loadTemplate('guest_register', false, $content);