Subversion-Projekte lars-tiefland.openvz_admin

Revision

Revision 9 | Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

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