Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 109 | Revision 165 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 109 Revision 162
Zeile 1... Zeile 1...
1
<?
1
<?
2
	//$Id: user.class.php 109 2008-05-09 22:19:52Z lars $
2
    //$Id: user.class.php 162 2010-03-12 23:25:46Z lars $
3
	/**
3
    /**
4
	 * 	@package	openvz_admin
4
     * 	@package	openvz_admin
5
	 * 	@author		Lars Tiefland <ltiefland@gmail.com> 
5
     * 	@author		Lars Tiefland <ltiefland@gmail.com> 
6
	 **/
6
     **/
7
	class User
7
    class User
8
	{
8
    {
9
		var $u_id;
9
        var $u_id;
10
		var $u_name;
10
        var $u_name;
11
		var $u_password;
11
        var $u_password;
12
		var $u_key;
12
        var $u_key;
13
		var $u_active;
13
        var $u_active;
14
		var $u_type;
14
        var $u_type;
15
		var $u_email;
15
        var $u_email;
16
		var $u_lang;
16
        var $u_lang;
Zeile 17... Zeile 17...
17
 
17
 
18
		function User($user)
18
        function User( $user )
19
		{
19
        {
20
			global $db, $db_meld, $error, $meld;
20
            global $db, $db_meld, $error, $meld;
21
			if ($user=="")
21
            if ( $user == "" )
22
			{
22
            {
23
				$this->u_name="";
23
                $this->u_name = "";
24
				$this->u_type=0;
24
                $this->u_type = 0;
25
				$this->u_email="";
25
                $this->u_email = "";
26
				$this->u_password=md5("");
26
                $this->u_password = md5( "" );
27
				$this->u_key="";
27
                $this->u_key = "";
28
				$this->u_active=1;
28
                $this->u_active = 1;
29
				$this->u_lang="en";
29
                $this->u_lang = "en";
30
			}
30
            }
31
			else
31
            else
32
			{
32
            {
33
				$this->u_name=$user;
33
                $this->u_name = $user;
-
 
34
                $sql = "SELECT * FROM auth_user WHERE u_name='" . $this->u_name .
34
				$sql="SELECT * FROM auth_user WHERE u_name='".$this->u_name."'";
35
                    "'";
35
				$res=$db->query($sql);
36
                $res = $db->query( $sql );
36
				if (true == DB::isError($res))
37
                if ( true == DB::isError( $res ) )
37
				{
38
                {
38
					$error="true";
39
                    $error = "true";
39
					$meld="Ein Fehler ist aufgetreten!";
40
                    $meld = "Ein Fehler ist aufgetreten!";
40
					$db_meld=$res->getUserInfo();
41
                    $db_meld = $res->getUserInfo();
41
					return $error;
42
                    return $error;
42
				}
43
                }
43
				else
44
                else
44
				{
45
                {
45
					$row=$res->fetchRow();
46
                    $row = $res->fetchRow();
46
					$this->u_id=$row["u_id"];
47
                    $this->u_id = $row["u_id"];
47
					$this->u_name=$row["u_name"];
48
                    $this->u_name = $row["u_name"];
48
					$this->u_type=$row["u_type"];
49
                    $this->u_type = $row["u_type"];
49
					$this->u_email=$row["u_email"];
50
                    $this->u_email = $row["u_email"];
50
					$this->u_password=$row["u_password"];
51
                    $this->u_password = $row["u_password"];
51
					$this->u_active=$row["u_active"];
52
                    $this->u_active = $row["u_active"];
52
					$this->u_key=$row["u_key"];
53
                    $this->u_key = $row["u_key"];
53
					$this->u_lang=$row["u_lang"];
54
                    $this->u_lang = $row["u_lang"];
54
					return $this;
55
                    return $this;
55
				}
56
                }
56
			}
57
            }
Zeile 57... Zeile 58...
57
		} 
58
        }
58
 
59
 
59
		function UserListe($limit, $start=0)
60
        function UserListe( $limit, $start = 0 )
60
		{
61
        {
61
			$sql="SELECT * FROM auth_user";
62
            $sql = "SELECT * FROM auth_user";
62
			global $db, $meld, $db_meld, $error;
63
            global $db, $meld, $db_meld, $error;
63
			if ($db->provides('limit') && $limit > 0)
64
            if ( $db->provides( 'limit' ) && $limit > 0 )
64
			{
65
            {
65
				$res=$db->limitquery($sql, $start, $limit);
66
                $res = $db->limitquery( $sql, $start, $limit );
66
			}
67
            }
67
			else
68
            else
68
			{
69
            {
69
				$res=$db->query($sql);
70
                $res = $db->query( $sql );
70
			}
71
            }
71
			if (true == DB::isError($res))
72
            if ( true == DB::isError( $res ) )
72
			{
73
            {
73
				$error=true;
74
                $error = true;
74
				$meld="Ein Fehler ist aufgetreten!";
75
                $meld = "Ein Fehler ist aufgetreten!";
75
				$db_meld=$res->getUserInfo();
76
                $db_meld = $res->getUserInfo();
76
			}
77
            }
Zeile 77... Zeile 78...
77
			return $res;
78
            return $res;
-
 
79
        }
78
		}
80
 
79
 
81
        function update( $u_id, $u_name, $u_email, $u_type, $u_lang, $u_active,
80
		function update($u_id, $u_name, $u_email, $u_type, $u_lang, $u_active, $u_key)
82
            $u_key )
81
		{
83
        {
82
			$this->u_name=$u_name;
84
            $this->u_name = $u_name;
83
			$this->u_email=$u_email;
85
            $this->u_email = $u_email;
84
			$this->u_type=$u_type;
86
            $this->u_type = $u_type;
85
			$this->u_lang=$u_lang;
87
            $this->u_lang = $u_lang;
86
			$this->u_id=$u_id;
88
            $this->u_id = $u_id;
Zeile 87... Zeile 89...
87
			$this->u_active=$u_active;
89
            $this->u_active = $u_active;
88
			$this->u_key=$u_key;
90
            $this->u_key = $u_key;
89
		}
91
        }
90
 
92
 
91
		function save()
93
        function save()
92
		{
94
        {
93
			global $db;
95
            global $db;
94
			$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";
96
            $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";
95
			return $db->query($sql);
97
            return $db->query( $sql );
96
		}
98
        }
97
		function UserData($u_name)
99
        function UserData( $u_name )
98
		{
100
        {
99
			global $db, $error, $meld, $db_meld;
101
            global $db, $error, $meld, $db_meld;
100
			$sql="SELECT * FROM auth_user WHERE u_name='$u_name'";
102
            $sql = "SELECT * FROM auth_user WHERE u_name='$u_name'";
101
			$res=$db->query($sql);
103
            $res = $db->query( $sql );
102
			if (true == DB::isError($res))
104
            if ( true == DB::isError( $res ) )
103
			{
105
            {
104
				$error="true";
106
                $error = "true";
105
				$meld="Ein Fehler ist aufgetreten!";
107
                $meld = "Ein Fehler ist aufgetreten!";
106
				$db_meld=$res->getUserInfo();
108
                $db_meld = $res->getUserInfo();
107
				return $error;
109
                return $error;
108
			}
110
            }
109
			else
111
            else
110
			{
112
            {
111
				$row=$res->fetchRow();
113
                $row = $res->fetchRow();
112
				$this->u_id=$row["u_id"];
114
                $this->u_id = $row["u_id"];
113
				$this->u_name=$row["u_name"];
115
                $this->u_name = $row["u_name"];
114
				$this->u_email=$row["u_email"];
116
                $this->u_email = $row["u_email"];
115
				$this->u_type=$row["u_type"];
117
                $this->u_type = $row["u_type"];
116
				$this->u_password=$row["u_password"];
118
                $this->u_password = $row["u_password"];
117
				$this->u_active=$row["u_active"];
119
                $this->u_active = $row["u_active"];
118
				$this->u_key=$row["u_key"];
120
                $this->u_key = $row["u_key"];
119
				$this->u_lang=$row["u_lang"];
121
                $this->u_lang = $row["u_lang"];
120
				return $this;
122
                return $this;