Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 9 | Revision 162 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?
        //$Id: user.class.php 109 2008-05-09 22:19:52Z lars $
        /**
         *      @package        openvz_admin
         *      @author         Lars Tiefland <ltiefland@gmail.com> 
         **/
        class User
        {
                var $u_id;
                var $u_name;
                var $u_password;
                var $u_key;
                var $u_active;
                var $u_type;
                var $u_email;
                var $u_lang;

                function User($user)
                {
                        global $db, $db_meld, $error, $meld;
                        if ($user=="")
                        {
                                $this->u_name="";
                                $this->u_type=0;
                                $this->u_email="";
                                $this->u_password=md5("");
                                $this->u_key="";
                                $this->u_active=1;
                                $this->u_lang="en";
                        }
                        else
                        {
                                $this->u_name=$user;
                                $sql="SELECT * FROM auth_user WHERE u_name='".$this->u_name."'";
                                $res=$db->query($sql);
                                if (true == DB::isError($res))
                                {
                                        $error="true";
                                        $meld="Ein Fehler ist aufgetreten!";
                                        $db_meld=$res->getUserInfo();
                                        return $error;
                                }
                                else
                                {
                                        $row=$res->fetchRow();
                                        $this->u_id=$row["u_id"];
                                        $this->u_name=$row["u_name"];
                                        $this->u_type=$row["u_type"];
                                        $this->u_email=$row["u_email"];
                                        $this->u_password=$row["u_password"];
                                        $this->u_active=$row["u_active"];
                                        $this->u_key=$row["u_key"];
                                        $this->u_lang=$row["u_lang"];
                                        return $this;
                                }
                        }
                } 

                function UserListe($limit, $start=0)
                {
                        $sql="SELECT * FROM auth_user";
                        global $db, $meld, $db_meld, $error;
                        if ($db->provides('limit') && $limit > 0)
                        {
                                $res=$db->limitquery($sql, $start, $limit);
                        }
                        else
                        {
                                $res=$db->query($sql);
                        }
                        if (true == DB::isError($res))
                        {
                                $error=true;
                                $meld="Ein Fehler ist aufgetreten!";
                                $db_meld=$res->getUserInfo();
                        }
                        return $res;
                }

                function update($u_id, $u_name, $u_email, $u_type, $u_lang, $u_active, $u_key)
                {
                        $this->u_name=$u_name;
                        $this->u_email=$u_email;
                        $this->u_type=$u_type;
                        $this->u_lang=$u_lang;
                        $this->u_id=$u_id;
                        $this->u_active=$u_active;
                        $this->u_key=$u_key;
                }

                function save()
                {
                        global $db;
                        $sql="UPDATE auth_user SET u_name='$this->u_name', u_email='$this->u_email', u_type=$this->u_type, u_lang='$this->u_lang', u_active=$this->u_active, u_key='$this->u_key' WHERE u_id=$this->u_id";
                        return $db->query($sql);
                }
                function UserData($u_name)
                {
                        global $db, $error, $meld, $db_meld;
                        $sql="SELECT * FROM auth_user WHERE u_name='$u_name'";
                        $res=$db->query($sql);
                        if (true == DB::isError($res))
                        {
                                $error="true";
                                $meld="Ein Fehler ist aufgetreten!";
                                $db_meld=$res->getUserInfo();
                                return $error;
                        }
                        else
                        {
                                $row=$res->fetchRow();
                                $this->u_id=$row["u_id"];
                                $this->u_name=$row["u_name"];
                                $this->u_email=$row["u_email"];
                                $this->u_type=$row["u_type"];
                                $this->u_password=$row["u_password"];
                                $this->u_active=$row["u_active"];
                                $this->u_key=$row["u_key"];
                                $this->u_lang=$row["u_lang"];
                                return $this;
                        }
                }
        }
?>