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'))))
73 // Don't change the password
76 elseif ((REQUEST_POST('pass1') == REQUEST_POST('pass2')))
78 // Change the password
80 $ADD = ", password='".generateHash(REQUEST_POST('pass1'))."'";
84 // We have to add the following things: birthday and max receive mails
85 SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET
95 WHERE userid=%s LIMIT 1",
97 substr(REQUEST_POST('gender'), 0, 1),
98 REQUEST_POST('surname'),
99 REQUEST_POST('family'),
100 REQUEST_POST('street_nr'),
101 REQUEST_POST('country'),
102 bigintval(REQUEST_POST('zip')),
103 REQUEST_POST('city'),
104 REQUEST_POST('email'),
105 bigintval(REQUEST_GET('uid')),
106 ), __FILE__, __LINE__);
107 $content = USER_ACCOUNT_SAVED;
111 // Problem while saving data
112 $content = USER_ACCOUNT_NOT_SAVED;
116 LOAD_TEMPLATE("admin_settings_saved", false, $content);
120 // Display form to edit
121 list($gender, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
122 SQL_FREERESULT($result_main);
124 // Transfer data to constants for the template
128 define('_GENDER_M', " selected=\"selected\"");
129 define('_GENDER_F', "");
130 define('_GENDER_C', "");
134 define('_GENDER_M', "");
135 define('_GENDER_F', " selected=\"selected\"");
136 define('_GENDER_C', "");
140 define('_GENDER_M', "");
141 define('_GENDER_F', "");
142 define('_GENDER_C', " selected=\"selected\"");
146 define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY' , $city);
147 define('_STREET' , $street); define('_ZIP' , $zip); define('_MAX_MAILS', $max);
148 define('_COUNTRY', $country); define('_EMAIL' , $email);
151 LOAD_TEMPLATE("admin_edit_user", false, bigintval(REQUEST_GET('uid')));
154 // Account does not exists!
155 LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"admin_failed\">".sprintf(getMessage('ADMIN_MEMBER_404'), REQUEST_GET('uid'))."</div>");