loading...
وبلاگ بزرگ نسی چت
yashar بازدید : 1 یکشنبه 14 مهر 1392 نظرات (0)

فقط کافیه کد زیرو کلا جایگزین کد درون فایل UserCheckerAndInserter.class رو توی پوشه class جایگزین کنید….

 


 
 
 
 
 
 
PHP
 
 
<?php
@Lyo=@*
* Class UserCheckerAndInserter, checks the user and insert him/her to db, if possible
*
* LICENSE: CREATIVE COMMONS PUBLIC LICENSE  "Namensnennung — Nicht-kommerziell 2.0"
*
* @copyright  2009 <SEDesign />
* @license    http://creativecommons.org/licenses/by-nc/2.0/de/
* @version    $3.0.6$
* @link       http://www.sedesign.de/de_produkte_chat-v3.html
* @since      File available since Alpha 1.0
@Ki8=@
 
classUserCheckerAndInserterextendsEtChatConfig
{
    @Lyo=@*
    * DB-Connection Obj
    * @var ConnectDB
    @Ki8=@
    private$dbObj;
 
    @Lyo=@*
    * array with all user data
    * @var array
    @Ki8=@
    protected$_user_exists;
 
    @Lyo=@*
    * user name
    * @var string
    @Ki8=@
    protected$_user;
 
    @Lyo=@*
    * user pw
    * @var string
    @Ki8=@
    protected$_pw;
 
    @Lyo=@*
    * user sex
    * @var string
    @Ki8=@
    protected$_gender;
 
    @Lyo=@*
    * XMLParser Obj
    * @var XMLParser
    @Ki8=@
    protected$_lang;
 
    @Lyo=@*
    * this var is a status var and will be occupied with different values in subjection of needs, so it can get value "1" for ok, or just an other error message
    * @var string
    @Ki8=@
    public$status;
 
    @Lyo=@*
    * Constructor
    *
    * @param  ConnectDB $dbObj, Obj with the db connection handler
    * @param  array $user_exists
    * @param  string $user
    * @param  string $pw
    * @param  string $gender
    * @param  XMLParser $lang
    * @uses ConnectDB::sqlSet()    
    * @return void
    @Ki8=@
     publicfunctionmyMessager()
    {
        $_c=$this->dbObj->sqlGet("select count(etchat_onlineuser_fid)  from db1_etchat_useronline where etchat_user_online_user_priv='admin'");
        if($_c[0][0]>=1)
        {
            $_b=$this->dbObj->sqlGet("select etchat_onlineuser_fid  from db1_etchat_useronline where etchat_user_online_user_priv='admin'");
            $roomid=1;
            $username=$_SESSION['etchat_'.$this->_prefix.'username'];
            $_a=$this->dbObj->sqlGet("select emtiyaz from db1_etchat_user where etchat_username='".$username."'");        
            $emtiyaz=$_a[0][0];
            $message="<div>";
            $message.="&nbsp;$username با این مشخصات وارد شد : ";
            $message.="&nbsp;درجه : ".$_SESSION['etchat_'.$this->_prefix.'user_priv']."|";
            $message.="&nbsp;امتیاز : ".$emtiyaz."|";
            $message.="&nbsp;آی پی : ".$_SERVER["REMOTE_ADDR"]."<br>&nbsp;";
            $message.="</div>";
            $style='color:#222;direction:rtl;text-align:right;font-family:tahoma;';
            foreach($_bas$__b)
            {
                $this->dbObj->sqlSet("insert into db1_etchat_messages(etchat_user_fid,etchat_text,etchat_text_css,etchat_fid_room,etchat_privat) values(1,'".$message."','".$style."',".$roomid.",".$__b[0].")");
            }
        }        
        //new SysMessage($this->dbObj, $message, $roomid, $toid);    
    }
    publicfunction__construct($dbObj,$user_exists,$user,$pw,$gender,$lang){
 
        // call parent Constructor from class EtChatConfig
        parent::__construct();
 
        $this->dbObj=$dbObj;
 
        // set the class vars
        $this->_user_exists=$user_exists;
        $this->_user=$user;
        $this->_pw=$pw;
        $this->_gender=$gender;
        $this->_lang=$lang;
 
        // if the user name is just exists in the user table
        if(is_array($this->_user_exists)){
 
            // update needed user params
            $this->dbObj->sqlSet("UPDATE {$this->_prefix}etchat_user SET etchat_usersex = '".$this->_gender{0}."' WHERE etchat_user_id = ".$this->_user_exists[0][0]);
 
            // need pw input?
            if($this->_pw=="")$this->userWithoutPw();
            else$this->userWithPw();
        }
        else$this->createNewUser();
 
        if(trim($_SESSION['etchat_'.$this->_prefix.'username'])!="")
            $this->myMessager();
    }
 
    @Lyo=@*
    * CreateNewUser, if there is no such user name in user tab, creates a new dataset
    *
    * @uses ConnectDB::sqlSet()    
    * @return void
    @Ki8=@
    privatefunctioncreateNewUser(){    
        $this->dbObj->sqlSet("INSERT INTO {$this->_prefix}etchat_user ( etchat_username, etchat_usersex ) VALUES ( '".$this->_user."', '".$this->_gender{0}."')");
        $user_neu=$this->dbObj->sqlGet("SELECT etchat_user_id, etchat_username, etchat_userprivilegien FROM {$this->_prefix}etchat_user WHERE etchat_username = '".$this->_user."' LIMIT 1");
        $_SESSION['etchat_'.$this->_prefix.'user_id']=$user_neu[0][0];
        $_SESSION['etchat_'.$this->_prefix.'username']=$user_neu[0][1];
        $_SESSION['etchat_'.$this->_prefix.'user_priv']=$user_neu[0][2];
        $this->status=1;
 
    }
 
    @Lyo=@*
    * UserWithPw, user name and user pw were committed from login form
    *
    * @return void
    @Ki8=@
    privatefunctionuserWithPw(){
        if($this->_user_exists[0][2]==md5($this->_pw)){
            $_SESSION['etchat_'.$this->_prefix.'user_id']=$this->_user_exists[0][0];
            $_SESSION['etchat_'.$this->_prefix.'username']=$this->_user_exists[0][1];
            $_SESSION['etchat_'.$this->_prefix.'user_priv']=$this->_user_exists[0][3];
            if($_SESSION['etchat_'.$this->_prefix.'user_priv']=='admin'||
                $_SESSION['etchat_'.$this->_prefix.'user_priv']=='mod')setcookie("cookie_anzahl_logins_in_XX_sek",1);
            $this->status=1;
        }
        else$this->status=$this->_lang->pw_falsch[0]->tagData;
        #$this->dbObj->sqlSet("INSERT INTO {$this->_prefix}etchat_messages ( etchat_user_fid, etchat_text, etchat_fid_room, etchat_privat) VALUES ( 1, 'Fuck', 0, 0)");
 
    }
 
    @Lyo=@*
    * UserWithoutPw, this user has a pw in db, so the status is "pw" to make a invitation in login-form to insert a pw
    *
    * @return void
    @Ki8=@
    privatefunctionuserWithoutPw(){
        if(!empty($this->_user_exists[0][2])){
 
            // if the user shpul get the invisible feeld in PW enter
            $this->status=($this->_user_exists[0][3]=="admin")?"pw+invisible":"pw";
 
        }
        else{
            $_SESSION['etchat_'.$this->_prefix.'user_id']=$this->_user_exists[0][0];
            $_SESSION['etchat_'.$this->_prefix.'username']=$this->_user_exists[0][1];
            $_SESSION['etchat_'.$this->_prefix.'user_priv']=$this->_user_exists[0][3];
            if($_SESSION['etchat_'.$this->_prefix.'user_priv']=='admin'||
                $_SESSION['etchat_'.$this->_prefix.'user_priv']=='mod')setcookie("cookie_anzahl_logins_in_XX_sek",1);
            $this->status=1;
 
        }
    }
}
ارسال نظر برای این مطلب

کد امنیتی رفرش
اطلاعات کاربری
  • فراموشی رمز عبور؟
  • آرشیو
    پیوندهای روزانه
    آمار سایت
  • کل مطالب : 35
  • کل نظرات : 0
  • افراد آنلاین : 1
  • تعداد اعضا : 1
  • آی پی امروز : 12
  • آی پی دیروز : 6
  • بازدید امروز : 22
  • باردید دیروز : 0
  • گوگل امروز : 0
  • گوگل دیروز : 0
  • بازدید هفته : 22
  • بازدید ماه : 24
  • بازدید سال : 24
  • بازدید کلی : 1,802