Source for file AdminUpdateUser.class.php

Documentation is available at AdminUpdateUser.class.php

  1. <?php
  2. /**
  3.  * Class AdminUpdateUser - Admin area
  4.  *
  5.  * LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
  6.  *
  7.  * @copyright  2009 <SEDesign />
  8.  * @license    http://creativecommons.org/licenses/by-nc/2.0/de/
  9.  * @version    $3.0.6$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. {
  15.  
  16.     /**
  17.     * Constructor
  18.     *
  19.     * @uses ConnectDB::sqlSet()
  20.     * @uses ConnectDB::sqlGet()
  21.     * @uses ConnectDB::close()
  22.     * @return void 
  23.     */
  24.     public function __construct ()
  25.         
  26.         // call parent Constructor from class DbConectionMaker
  27.         parent::__construct()
  28.  
  29.         session_start();
  30.  
  31.         header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
  32.         // Sets charset and content-type for index.php
  33.         header('content-type: text/html; charset=utf-8');
  34.         
  35.         // create new LangXml Object
  36.         $langObj = new LangXml();
  37.         $lang=$langObj->getLang()->admin[0]->admin_user[0];
  38.         
  39.         
  40.         if ($_SESSION['etchat_'.$this->_prefix.'user_priv']=="admin"){
  41.             
  42.         $pass (!empty($_POST['pw'])) "etchat_userpw = '".md5($_POST['pw'])."'," "";
  43.  
  44.         if ($_POST['priv']=="mod"){
  45.             // Test if there any Admins in the DB now
  46.             $res $this->dbObj->sqlGet("select count(etchat_user_id) FROM {$this->_prefix}etchat_user where etchat_user_id <> ".(int)$_POST['id']." AND etchat_userprivilegien = 'admin'");
  47.             if ($res[0][0]==0){
  48.                 echo "Not possible. There will be no administrators in chat.<br><br><a href=\"./?AdminUserIndex\">back</a>";
  49.                 return false;
  50.             }
  51.         }
  52.         
  53.         // Checks if this user exists and is an admin
  54.         $res_dop = $this->dbObj->sqlGet("select count(etchat_user_id) FROM {$this->_prefix}etchat_user where etchat_username = '".htmlentities($_POST['user'], ENT_QUOTES, "UTF-8")."' and etchat_userprivilegien <> 'gast' and etchat_user_id<>".(int)$_POST['id']);
  55.         if ($res_dop[0][0]>0){
  56.             echo "Not possible, because a user with this name exists.<br><br><a href=\"./?AdminUserIndex\">back</a>";
  57.             return false;
  58.         }
  59.         $this->dbObj->sqlSet("UPDATE {$this->_prefix}etchat_user SET ".$pass." etchat_username = '".htmlentities($_POST['user'], ENT_QUOTES, "UTF-8")."', etchat_userprivilegien  = '".htmlentities($_POST['priv'], ENT_QUOTES, "UTF-8")."' WHERE etchat_user_id=".(int)$_POST['id']);
  60.  
  61.         $this->dbObj->close();
  62.         header("Location: ./?AdminUserIndex");
  63.             
  64.         }else{
  65.             echo $lang->error[0]->tagData;
  66.             return false;
  67.         }
  68.     }

Documentation generated on Thu, 05 May 2011 14:05:54 +0000 by phpDocumentor 1.4.3