Subversion-Projekte lars-tiefland.em_wm

Revision

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