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 * Copyright (c) 2003 - 2008 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')) || (!IS_ADMIN())) {
41 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
45 // Add description as navigation point
46 ADD_DESCR('admin', __FILE__);
50 if (REQUEST_ISSET_GET('uid')) {
51 // 0 1 2 3 4 5 6 7 8 9 10 11
52 $result_main = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails
53 FROM `{!_MYSQL_PREFIX!}_user_data`
56 array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__);
59 if ((SQL_NUMROWS($result_main) == 1) || (!REQUEST_ISSET_GET('uid')))
62 if (!REQUEST_ISSET_GET('uid'))
64 // Output selection form with all confirmed user accounts listed
65 ADD_MEMBER_SELECTION_BOX();
67 elseif (REQUEST_ISSET_POST('edit'))
69 // Ok, change the account...
70 $PASS = false; $add = '';
71 if ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass2'))) {
72 // Don't change the password
74 } elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2'))) {
75 // Change the password
77 $add = ", `password`='" . generateHash(REQUEST_POST('pass1')) . "'";
81 // We have to add the following things: birthday and max receive mails
82 SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
92 WHERE userid=%s LIMIT 1",
94 substr(REQUEST_POST('gender'), 0, 1),
95 REQUEST_POST('surname'),
96 REQUEST_POST('family'),
97 REQUEST_POST('street_nr'),
98 REQUEST_POST('country'),
99 bigintval(REQUEST_POST('zip')),
100 REQUEST_POST('city'),
101 REQUEST_POST('email'),
102 bigintval(REQUEST_GET('uid')),
103 ), __FILE__, __LINE__);
104 $content = getMessage('USER_ACCOUNT_SAVED');
106 // Problem while saving data
107 $content = getMessage('USER_ACCOUNT_NOT_SAVED');
111 LOAD_TEMPLATE('admin_settings_saved', false, $content);
113 // Display form to edit
114 list($gender, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
116 // Transfer data to constants for the template
119 define('_GENDER_M', ' selected="selected"');
120 define('_GENDER_F', '');
121 define('_GENDER_C', '');
125 define('_GENDER_M', '');
126 define('_GENDER_F', ' selected="selected"');
127 define('_GENDER_C', '');
131 define('_GENDER_M', '');
132 define('_GENDER_F', '');
133 define('_GENDER_C', ' selected="selected"');
137 define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY' , $city);
138 define('_STREET' , $street); define('_ZIP' , $zip); define('_MAX_MAILS', $max);
139 define('_COUNTRY', $country); define('_EMAIL' , $email);
142 LOAD_TEMPLATE('admin_edit_user', false, bigintval(REQUEST_GET('uid')));
145 // Account does not exists!
146 LOAD_TEMPLATE('admin_settings_saved', false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");
150 SQL_FREERESULT($result_main);