Subversion-Projekte lars-tiefland.openvz_admin

Revision

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

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