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 * For more information visit: http://www.mxchange.org *
25 * This program is free software; you can redistribute it and/or modify *
26 * it under the terms of the GNU General Public License as published by *
27 * the Free Software Foundation; either version 2 of the License, or *
28 * (at your option) any later version. *
30 * This program is distributed in the hope that it will be useful, *
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
33 * GNU General Public License for more details. *
35 * You should have received a copy of the GNU General Public License *
36 * along with this program; if not, write to the Free Software *
37 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
39 ************************************************************************/
41 // Some security stuff...
42 if ((!defined('__SECURITY')) || (!isAdmin())) {
46 // Add description as navigation point
47 addMenuDescription('admin', __FILE__);
51 if (isGetRequestParameterSet('userid')) {
53 $result_main = SQL_QUERY_ESC("SELECT
54 `userid`, `gender`, `surname`, `family`, `street_nr`, `zip`, `city`, `country`,
56 `birth_day`, `birth_month`, `birth_year`,
59 `{?_MYSQL_PREFIX?}_user_data`
64 bigintval(getRequestParameter('userid'))
65 ), __FILE__, __LINE__);
68 if ((SQL_NUMROWS($result_main) == 1) || (!isGetRequestParameterSet('userid'))) {
70 if (!isGetRequestParameterSet('userid')) {
71 // Output selection form with all confirmed user accounts listed
72 addMemberSelectionBox();
73 } elseif (isPostRequestParameterSet('edit')) {
74 // Ok, change the account...
75 $updateUser = false; $add = '';
76 if ((!isPostRequestParameterSet('pass1')) && (!isPostRequestParameterSet('pass2'))) {
77 // Don't change the password
79 } elseif ((postRequestParameter('pass1') == postRequestParameter('pass2'))) {
80 // Change the password
82 $add = ", `password`='" . generateHash(postRequestParameter('pass1')) . "'";
85 if ($updateUser === true) {
86 // We have to add the following things: birthday and max receive mails
88 `{?_MYSQL_PREFIX?}_user_data`
103 substr(postRequestParameter('gender'), 0, 1),
104 postRequestParameter('surname'),
105 postRequestParameter('family'),
106 postRequestParameter('street_nr'),
107 postRequestParameter('country'),
108 bigintval(postRequestParameter('zip')),
109 postRequestParameter('city'),
110 postRequestParameter('email'),
111 bigintval(getRequestParameter('userid')),
112 ), __FILE__, __LINE__);
113 $content = getMessage('USER_ACCOUNT_SAVED');
115 // Problem while saving data
116 $content = getMessage('USER_ACCOUNT_NOT_SAVED');
120 loadTemplate('admin_settings_saved', false, $content);
123 $content = SQL_FETCHARRAY($result_main);
126 foreach (array('gender_m','gender_f','gender_c') as $entry) {
127 $content[$entry] = '';
130 // Prepare selections
131 $content['gender_' . strtolower($content['gender'])] = ' selected="selected"';
134 loadTemplate('admin_edit_user', false, $content);
137 // Account does not exists!
138 loadTemplate('admin_settings_saved', false, '<div class="admin_failed">' . getMaskedMessage('ADMIN_MEMBER_404', getRequestParameter('userid')) . '</div>');
142 SQL_FREERESULT($result_main);