win32 to unix line delimiters changed
[mailer.git] / 0.2.1 / inc / modules / admin / what-edit_user.php
index d054835e0cf181b94842da329e919d5a6703a27b..2e4f4f8be29189aecc72cfdb7481b3cc3a4dac41 100644 (file)
-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1                                    Start: 09/28/2003 *\r
- * ===============                              Last change: 06/10/2004 *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * File              : what-edit_user.php                               *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Edit member's profiles                           *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung  : Mitgliederprofile �ndern                         *\r
- * -------------------------------------------------------------------- *\r
- *                                                                      *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
- * For more information visit: http://www.mxchange.org                  *\r
- *                                                                      *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or    *\r
- * (at your option) any later version.                                  *\r
- *                                                                      *\r
- * This program is distributed in the hope that it will be useful,      *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
- * GNU General Public License for more details.                         *\r
- *                                                                      *\r
- * You should have received a copy of the GNU General Public License    *\r
- * along with this program; if not, write to the Free Software          *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
- * MA  02110-1301  USA                                                  *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))\r
-{\r
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
-       require($INC);\r
-}\r
-// Add description as navigation point\r
-ADD_DESCR("admin", basename(__FILE__));\r
-\r
-OPEN_TABLE("100%", "admin_content admin_content_align", "");\r
-\r
-// Fix a notice\r
-$result_main = false;\r
-if (isset($_GET['u_id'])) {\r
-       //                                    0      1        2         3      4     5      6       7         8          9           10         11\r
-       $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
-        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);\r
-}\r
-\r
-if ((SQL_NUMROWS($result_main) == 1) || (empty($_GET['u_id'])))\r
-{\r
-       // User found\r
-       if (empty($_GET['u_id']))\r
-       {\r
-               // Output selection form with all confirmed user accounts listed\r
-               ADD_MEMBER_SELECTION_BOX();\r
-       }\r
-        elseif (isset($_POST['edit']))\r
-       {\r
-               // Ok, change the account...\r
-               $PASS = false; $ADD = "";\r
-               if ((empty($_POST['pass1'])) && (empty($_POST['pass2'])))\r
-               {\r
-                       // Don't change the password\r
-                       $PASS = true;\r
-               }\r
-                elseif (($_POST['pass1'] == $_POST['pass2']))\r
-               {\r
-                       // Change the password\r
-                       $PASS = true;\r
-                       $ADD = ", password='".generateHash($_POST['pass1'])."'";\r
-               }\r
-               if ($PASS)\r
-               {\r
-                       // We have to add the following things: birthday and max receive mails\r
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET\r
-sex='%s',\r
-surname='%s',\r
-family='%s',\r
-street_nr='%s',\r
-country='%s',\r
-zip=%d,\r
-city='%s',\r
-email='%s'\r
-".$ADD."\r
-WHERE userid=%d LIMIT 1",\r
- array(\r
-       substr($_POST['salut'], 0, 1),\r
-       $_POST['surname'],\r
-       $_POST['family_name'],\r
-       $_POST['street_nr'],\r
-       $_POST['country'],\r
-       bigintval($_POST['zip']),\r
-       $_POST['city'],\r
-       $_POST['email'],\r
-       bigintval($_GET['u_id']),\r
-), __FILE__, __LINE__);\r
-                       $content = USER_ACCOUNT_SAVED;\r
-               }\r
-                else\r
-               {\r
-                       // Problem while saving data\r
-                       $content = USER_ACCOUNT_NOT_SAVED;\r
-               }\r
-\r
-               // Load template\r
-               LOAD_TEMPLATE("admin_settings_saved", false, $content);\r
-       }\r
-        else\r
-       {\r
-               // Display form to edit\r
-               list($sex, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);\r
-               SQL_FREERESULT($result_main);\r
-\r
-               // Transfer data to constants for the template\r
-               switch ($sex)\r
-               {\r
-               case "M":\r
-                       define('_SEX_M', " selected=\"selected\"");\r
-                       define('_SEX_F', "");\r
-                       define('_SEX_C', "");\r
-                       break;\r
-\r
-               case "F":\r
-                       define('_SEX_M', "");\r
-                       define('_SEX_F', " selected=\"selected\"");\r
-                       define('_SEX_C', "");\r
-                       break;\r
-\r
-               case "C":\r
-                       define('_SEX_M', "");\r
-                       define('_SEX_F', "");\r
-                       define('_SEX_C', " selected=\"selected\"");\r
-                       break;\r
-               }\r
-\r
-               define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY'     , $city);\r
-               define('_STREET' , $street);  define('_ZIP'   , $zip);    define('_MAX_MAILS', $max);\r
-               define('_COUNTRY', $country); define('_EMAIL' , $email);\r
-\r
-               // Load template\r
-               LOAD_TEMPLATE("admin_edit_user", false, bigintval($_GET['u_id']));\r
-       }\r
-}\r
- else\r
-{\r
-       // Account does not exists!\r
-       OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");\r
-}\r
-CLOSE_TABLE();\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1                                    Start: 09/28/2003 *
+ * ===============                              Last change: 06/10/2004 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-edit_user.php                               *
+ * -------------------------------------------------------------------- *
+ * Short description : Edit member's profiles                           *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Mitgliederprofile �ndern                         *
+ * -------------------------------------------------------------------- *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
+{
+       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+       require($INC);
+}
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+OPEN_TABLE("100%", "admin_content admin_content_align", "");
+
+// Fix a notice
+$result_main = false;
+if (isset($_GET['u_id'])) {
+       //                                    0      1        2         3      4     5      6       7         8          9           10         11
+       $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",
+        array(bigintval($_GET['u_id'])), __FILE__, __LINE__);
+}
+
+if ((SQL_NUMROWS($result_main) == 1) || (empty($_GET['u_id'])))
+{
+       // User found
+       if (empty($_GET['u_id']))
+       {
+               // Output selection form with all confirmed user accounts listed
+               ADD_MEMBER_SELECTION_BOX();
+       }
+        elseif (isset($_POST['edit']))
+       {
+               // Ok, change the account...
+               $PASS = false; $ADD = "";
+               if ((empty($_POST['pass1'])) && (empty($_POST['pass2'])))
+               {
+                       // Don't change the password
+                       $PASS = true;
+               }
+                elseif (($_POST['pass1'] == $_POST['pass2']))
+               {
+                       // Change the password
+                       $PASS = true;
+                       $ADD = ", password='".generateHash($_POST['pass1'])."'";
+               }
+               if ($PASS)
+               {
+                       // We have to add the following things: birthday and max receive mails
+                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET
+sex='%s',
+surname='%s',
+family='%s',
+street_nr='%s',
+country='%s',
+zip=%d,
+city='%s',
+email='%s'
+".$ADD."
+WHERE userid=%d LIMIT 1",
+ array(
+       substr($_POST['salut'], 0, 1),
+       $_POST['surname'],
+       $_POST['family_name'],
+       $_POST['street_nr'],
+       $_POST['country'],
+       bigintval($_POST['zip']),
+       $_POST['city'],
+       $_POST['email'],
+       bigintval($_GET['u_id']),
+), __FILE__, __LINE__);
+                       $content = USER_ACCOUNT_SAVED;
+               }
+                else
+               {
+                       // Problem while saving data
+                       $content = USER_ACCOUNT_NOT_SAVED;
+               }
+
+               // Load template
+               LOAD_TEMPLATE("admin_settings_saved", false, $content);
+       }
+        else
+       {
+               // Display form to edit
+               list($sex, $surname, $family, $street, $zip, $city, $country, $email, $bday, $bmonth, $byear, $max) = SQL_FETCHROW($result_main);
+               SQL_FREERESULT($result_main);
+
+               // Transfer data to constants for the template
+               switch ($sex)
+               {
+               case "M":
+                       define('_SEX_M', " selected=\"selected\"");
+                       define('_SEX_F', "");
+                       define('_SEX_C', "");
+                       break;
+
+               case "F":
+                       define('_SEX_M', "");
+                       define('_SEX_F', " selected=\"selected\"");
+                       define('_SEX_C', "");
+                       break;
+
+               case "C":
+                       define('_SEX_M', "");
+                       define('_SEX_F', "");
+                       define('_SEX_C', " selected=\"selected\"");
+                       break;
+               }
+
+               define('_SURNAME', $surname); define('_FAMILY', $family); define('_CITY'     , $city);
+               define('_STREET' , $street);  define('_ZIP'   , $zip);    define('_MAX_MAILS', $max);
+               define('_COUNTRY', $country); define('_EMAIL' , $email);
+
+               // Load template
+               LOAD_TEMPLATE("admin_edit_user", false, bigintval($_GET['u_id']));
+       }
+}
+ else
+{
+       // Account does not exists!
+       OUTPUT_HTML ("<STRONG class=\"admin_failed\">".ADMIN_MEMBER_404_1.$_GET['u_id'].ADMIN_MEMBER_404_2."</STRONG>");
+}
+CLOSE_TABLE();
+//
+?>