[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_lib/ -> profile.updateaccount.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2009 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  // ----------------------------------------------------------------
  24  // obligate check for phpwcms constants
  25  if (!defined('PHPWCMS_ROOT')) {
  26     die("You Cannot Access This Script Directly, Have a Nice Day.");
  27  }
  28  // ----------------------------------------------------------------
  29  
  30  
  31  
  32  //Prüfen, ob der Benutzername bereits vergeben ist, aber nur, wenn sich der
  33  //Benutzername geändert hat
  34  if($_SESSION["wcs_user"] != "guest") { //Prüfung für Gastzugang
  35      
  36      $err = '';
  37  
  38      $new_username = slweg($_POST["form_loginname"]);
  39      if ($new_username != $_SESSION["wcs_user"]) {
  40          $sql = "SELECT COUNT(usr_login) FROM ".DB_PREPEND."phpwcms_user WHERE usr_login='".aporeplace($new_username)."';"; 
  41          if($result = mysql_query($sql, $db)) {
  42              if($row = mysql_fetch_row($result)) {
  43                  if($row[0])    $err = str_replace('{VAL}', html_specialchars($new_username), $BL['be_profile_account_err1'])."\n";
  44              }
  45              mysql_free_result($result);
  46          }
  47      }
  48      if ($_POST["form_password"] == $_POST["form_password2"]) {
  49          if(strlen($_POST["form_password"]) > 0) {
  50          $new_password = slweg($_POST["form_password"]);
  51          if ( strlen($new_password) < 5) $err .= str_replace('{VAL}', strlen($new_password), $BL['be_profile_account_err2'])."\n";
  52          }
  53      } else {
  54          $err .= $BL['be_profile_account_err3']."\n";
  55      }
  56      $new_email = slweg(trim($_POST["form_useremail"]));
  57      if ($new_email != $_SESSION["wcs_user_email"]) {
  58          if( !is_valid_email($new_email) ) {
  59              $err .= str_replace('{VAL}', html_specialchars($new_email), $BL['be_profile_account_err4'])."\n";
  60          }
  61      }
  62      
  63      if($_POST["form_lang"]) {
  64          $new_language = slweg(trim($_POST["form_lang"]));
  65      } else {
  66          $new_language = $phpwcms["default_lang"];
  67      }
  68      
  69      $new_wysiwyg = empty($_POST['form_wysiwyg']) ? 0 : intval($_POST['form_wysiwyg']);
  70      $user_var['template'] = empty($_POST['form_wysiwyg_template']) ? '' : clean_slweg($_POST['form_wysiwyg_template']);
  71      
  72      
  73      //Jetzt die Daten aktualisieren
  74      
  75      if(empty($err)) {
  76      
  77          $sql  = "UPDATE ".DB_PREPEND."phpwcms_user SET ";
  78          $sql .= "   usr_login='".aporeplace($new_username)."', ";
  79          
  80          if(!empty($new_password)) {
  81              $sql .= "usr_pass='".aporeplace(md5($new_password))."', ";
  82          }
  83          
  84          $sql .= "usr_email='".aporeplace($new_email);
  85          $sql .= "', usr_lang='".aporeplace($new_language);
  86          $sql .= "', usr_wysiwyg=".$new_wysiwyg;
  87          $sql .= " , usr_vars='".aporeplace(serialize($user_var))."'";
  88          $sql .= " WHERE usr_id=".$_SESSION["wcs_user_id"];
  89          $sql .= " AND usr_login='".$_SESSION["wcs_user"]."' LIMIT 1";
  90  
  91          if(mysql_query($sql, $db)) {
  92              //Wenn Aktualisierung erfolgreich war
  93              //neue Werte den Sessionvariablen zuweisen
  94              $_SESSION["wcs_user"]             = $new_username;
  95              $_SESSION["wcs_user_email"]     = $new_email;
  96              $_SESSION["wcs_user_lang"]         = $new_language;
  97              $_SESSION["WYSIWYG_EDITOR"]        = $new_wysiwyg;
  98              $_SESSION["WYSIWYG_TEMPLATE"]    = $user_var['template'];
  99              
 100              set_language_cookie();
 101              
 102              headerRedirect(PHPWCMS_URL."phpwcms.php?do=profile");
 103          }
 104      }
 105  } //Ende Prüfung Gastzugang
 106  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7