Subversion-Projekte lars-tiefland.openvz_admin

Revision

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