2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 09/28/2003 *
\r
4 * =============== Last change: 06/10/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-edit_user.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Edit member's profiles *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Mitgliederprofile ändern *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2007 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 OPEN_TABLE("100%", "admin_content admin_content_align", "");
\r
46 $result_main = false;
\r
47 if (isset($_GET['u_id'])) {
\r
48 // 0 1 2 3 4 5 6 7 8 9 10 11
\r
49 $result_main = SQL_QUERY_ESC("SELECT sex, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
\r
50 array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
\r
53 if ((SQL_NUMROWS($result_main) == 1) || (empty($_GET['u_id'])))
\r
56 if (empty($_GET['u_id']))
\r
58 // Output selection form with all confirmed user accounts listed
\r
59 ADD_MEMBER_SELECTION_BOX();
\r
61 elseif (isset($_POST['edit']))
\r
63 // Ok, change the account...
\r
64 $PASS = false; $ADD = "";
\r
65 if ((empty($_POST['pass1'])) && (empty($_POST['pass2'])))
\r
67 // Don't change the password
\r
70 elseif (($_POST['pass1'] == $_POST['pass2']))
\r
72 // Change the password
\r
74 $ADD = ", password='".generateHash($_POST['pass1'])."'";
\r
78 // We have to add the following things: birthday and max receive mails
\r
79 $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET
\r
89 WHERE userid=%d LIMIT 1",
\r
91 substr($_POST['salut'], 0, 1),
\r
93 $_POST['family_name'],
\r
94 $_POST['street_nr'],
\r
96 bigintval($_POST['zip']),
\r
99 bigintval($_GET['u_id']),
\r
100 ), __FILE__, __LINE__);
\r
101 $content = USER_ACCOUNT_SAVED;
\r
105 // Problem while saving data
\r
106 $content = USER_ACCOUNT_NOT_SAVED;
\r
110 LOAD_TEMPLATE("admin_settings_saved", false, $content);
\r
114 // Display form to edit
\r
115 list($sex, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
\r
116 SQL_FREERESULT($result_main);
\r
118 // Transfer data to constants for the template
\r
122 define('_SEX_M', " selected=\"selected\"");
\r
123 define('_SEX_F', "");
\r
124 define('_SEX_C', "");
\r
128 define('_SEX_M', "");
\r
129 define('_SEX_F', " selected=\"selected\"");
\r
130 define('_SEX_C', "");
\r
134 define('_SEX_M', "");
\r
135 define('_SEX_F', "");
\r
136 define('_SEX_C', " selected=\"selected\"");
\r
140 define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY' , $city);
\r
141 define('_STREET' , $street); define('_ZIP' , $zip); define('_MAX_MAILS', $max);
\r
142 define('_COUNTRY', $country); define('_EMAIL' , $email);
\r
145 LOAD_TEMPLATE("admin_edit_user", false, bigintval($_GET['u_id']));
\r
150 // Account does not exists!
\r
151 OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");
\r