2 /************************************************************************
3 * MXChange v0.2.1 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 (isGetRequestElementSet('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(getRequestElement('userid'))
65 ), __FILE__, __LINE__);
68 if ((SQL_NUMROWS($result_main) == 1) || (!isGetRequestElementSet('userid'))) {
70 if (!isGetRequestElementSet('userid')) {
71 // Output selection form with all confirmed user accounts listed
72 addMemberSelectionBox();
73 } elseif (isPostRequestElementSet('edit')) {
74 // Ok, change the account...
75 $updateUser = false; $add = '';
76 if ((!isPostRequestElementSet('pass1')) && (!isPostRequestElementSet('pass2'))) {
77 // Don't change the password
79 } elseif ((postRequestElement('pass1') == postRequestElement('pass2'))) {
80 // Change the password
82 $add = ", `password`='" . generateHash(postRequestElement('pass1')) . "'";
85 if ($updateUser === true) {
86 // We have to add the following things: birthday and max receive mails
87 SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET
97 WHERE `userid`=%s LIMIT 1",
99 substr(postRequestElement('gender'), 0, 1),
100 postRequestElement('surname'),
101 postRequestElement('family'),
102 postRequestElement('street_nr'),
103 postRequestElement('country'),
104 bigintval(postRequestElement('zip')),
105 postRequestElement('city'),
106 postRequestElement('email'),
107 bigintval(getRequestElement('userid')),
108 ), __FILE__, __LINE__);
109 $content = getMessage('USER_ACCOUNT_SAVED');
111 // Problem while saving data
112 $content = getMessage('USER_ACCOUNT_NOT_SAVED');
116 loadTemplate('admin_settings_saved', false, $content);
119 $content = SQL_FETCHARRAY($result_main);
122 foreach (array('gender_m','gender_f','gender_c') as $entry) {
123 $content[$entry] = '';
126 // Prepare selections
127 $content['gender_' . strtolower($content['gender'])] = ' selected="selected"';
130 loadTemplate('admin_edit_user', false, $content);
133 // Account does not exists!
134 loadTemplate('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), getRequestElement('userid'))."</div>");
138 SQL_FREERESULT($result_main);