2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 09/28/2003 *
4 * =================== Last change: 06/10/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-edit_user.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Edit member's profiles *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Mitgliederprofile aendern *
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 * @TODO Add support for ext-country *
21 * -------------------------------------------------------------------- *
22 * Copyright (c) 2003 - 2009 by Roland Haeder *
23 * Copyright (c) 2009, 2010 by Mailer Developer Team *
24 * For more information visit: http://www.mxchange.org *
26 * This program is free software; you can redistribute it and/or modify *
27 * it under the terms of the GNU General Public License as published by *
28 * the Free Software Foundation; either version 2 of the License, or *
29 * (at your option) any later version. *
31 * This program is distributed in the hope that it will be useful, *
32 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
33 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
34 * GNU General Public License for more details. *
36 * You should have received a copy of the GNU General Public License *
37 * along with this program; if not, write to the Free Software *
38 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
40 ************************************************************************/
42 // Some security stuff...
43 if ((!defined('__SECURITY')) || (!isAdmin())) {
47 // Add description as navigation point
48 addMenuDescription('admin', __FILE__);
52 if (isGetRequestParameterSet('userid')) {
54 $result_main = SQL_QUERY_ESC("SELECT
55 `userid`, `gender`, `surname`, `family`, `street_nr`, `zip`, `city`, `country`,
57 `birth_day`, `birth_month`, `birth_year`,
60 `{?_MYSQL_PREFIX?}_user_data`
65 bigintval(getRequestParameter('userid'))
66 ), __FILE__, __LINE__);
69 if ((!isGetRequestParameterSet('userid')) || (SQL_NUMROWS($result_main) == 1)) {
71 if (!isGetRequestParameterSet('userid')) {
72 // Output selection form with all confirmed user accounts listed
73 addMemberSelectionBox();
74 } elseif (isFormSent('edit')) {
75 // Ok, change the account...
76 $updateUser = false; $add = '';
77 if ((!isPostRequestParameterSet('pass1')) && (!isPostRequestParameterSet('pass2'))) {
78 // Don't change the password
80 } elseif ((postRequestParameter('pass1') == postRequestParameter('pass2'))) {
81 // Change the password
83 $add = ", `password`='" . generateHash(postRequestParameter('pass1')) . "'";
86 if ($updateUser === true) {
87 // We have to add the following things: birthday and max receive mails
89 `{?_MYSQL_PREFIX?}_user_data`
104 substr(postRequestParameter('gender'), 0, 1),
105 postRequestParameter('surname'),
106 postRequestParameter('family'),
107 postRequestParameter('street_nr'),
108 postRequestParameter('country'),
109 bigintval(postRequestParameter('zip')),
110 postRequestParameter('city'),
111 postRequestParameter('email'),
112 bigintval(getRequestParameter('userid')),
113 ), __FILE__, __LINE__);
114 $content = getMessage('USER_ACCOUNT_SAVED');
116 // Problem while saving data
117 $content = getMessage('USER_ACCOUNT_NOT_SAVED');
121 loadTemplate('admin_settings_saved', false, $content);
124 $content = SQL_FETCHARRAY($result_main);
127 foreach (array('gender_m','gender_f','gender_c') as $entry) {
128 $content[$entry] = '';
131 // Prepare selections
132 $content['gender_' . strtolower($content['gender'])] = ' selected="selected"';
135 loadTemplate('admin_edit_user', false, $content);
138 // Account does not exists!
139 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', bigintval(getRequestParameter('userid'))) . '</div>');
143 SQL_FREERESULT($result_main);