Source for file ChangePw.class.php

Documentation is available at ChangePw.class.php

  1. <?php
  2. /**
  3.  * ChangePw, sets new Pw
  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.7$
  10.  * @link       http://www.sedesign.de/de_produkte_chat-v3.html
  11.  * @since      File available since Alpha 1.0
  12.  */
  13.  
  14. class ChangePw extends DbConectionMaker
  15. {
  16.     /**
  17.     * Constructor
  18.     *
  19.     * @uses ConnectDB::sqlSet()
  20.     * @uses ConnectDB::close()
  21.     * @return void 
  22.     */
  23.     public function __construct (){
  24.     
  25.         // call parent Constructor from class DbConectionMaker
  26.         parent::__construct();
  27.     
  28.         session_start();
  29.         
  30.         // all documentc requested per AJAX should have this part to turn off the browser and proxy cache for any XHR request
  31.         header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
  32.         
  33.         $userprivilegien $this->dbObj->sqlGet("select etchat_userprivilegien from {$this->_prefix}etchat_user WHERE etchat_user_id = ".(int)$_SESSION['etchat_'.$this->_prefix.'user_id']);
  34.         
  35.         if ($userprivilegien[0][0]=="admin" || $userprivilegien[0][0]=="mod" || $userprivilegien[0][0]=="user"){
  36.             $this->dbObj->sqlSet("UPDATE {$this->_prefix}etchat_user SET etchat_userpw = '".md5($_POST['modpw'])."' WHERE etchat_user_id = ".(int)$_SESSION['etchat_'.$this->_prefix.'user_id']);
  37.             echo "1";
  38.         }
  39.  
  40.         else if ($this->_allow_nick_registration && $_SESSION['etchat_'.$this->_prefix.'user_priv']=="gast" && !empty($_POST['user_pw'])){
  41.             
  42.             if (isset($_COOKIE['cookie_etchat_nik_registered'])){
  43.                 // create new LangXml Object
  44.                 $langObj = new LangXml();
  45.                 $lang=$langObj->getLang()->changepw_php[0];
  46.                 echo $lang->warning[0]->tagData;
  47.             }
  48.             else{    
  49.                 setcookie("cookie_etchat_nik_registered", "1", time()+(24*3600), "/");
  50.                 //setcookie("cookie_etchat_nik_registered", "1");
  51.                 $this->dbObj->sqlSet("UPDATE {$this->_prefix}etchat_user SET etchat_userpw = '".md5($_POST['user_pw'])."', etchat_userprivilegien='user', etchat_reg_timestamp=now(), etchat_reg_ip='".$_SERVER['REMOTE_ADDR']."' WHERE etchat_user_id = ".(int)$_SESSION['etchat_'.$this->_prefix.'user_id']);
  52.                 echo "1";
  53.             }
  54.         }
  55.         // close DB connection
  56.         $this->dbObj->close();
  57.     }

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