Subversion-Projekte lars-tiefland.em_wm

Revision

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

Revision 39 Revision 51
Zeile 3... Zeile 3...
3
	{
3
	{
4
		var $u_id;
4
		var $u_id;
5
		var $u_name;
5
		var $u_name;
6
		var $u_password;
6
		var $u_password;
7
		var $u_type;
7
		var $u_type;
8
		var $u_max_anz;
8
		var $u_email;
Zeile 9... Zeile 9...
9
 
9
 
10
		function User($user, $password)
10
		function User($user)
11
		{
11
		{
12
			global $db, $db_meld, $error, $meld;
12
			global $db, $db_meld, $error, $meld;
13
			if ($user=="")
13
			if ($user=="")
14
			{
14
			{
15
				$this->u_name="";
15
				$this->u_name="";
16
				$this->u_type=0;
16
				$this->u_type=0;
17
				$this->u_max_anz=10;
17
				$this->u_email="";
18
				$this->u_password=md5("");
18
				$this->u_password=md5("");
19
	  		}
19
			}
20
	  		else
20
			else
21
	  		{
21
			{
22
				$this->u_name=$user;
-
 
23
				$this->u_password=md5($password);
22
				$this->u_name=$user;
24
				$sql="SELECT * FROM auth_user WHERE u_name='".$this->u_name."' AND u_password='".$this->u_password."'";
23
				$sql="SELECT * FROM auth_user WHERE u_name='".$this->u_name."'";
25
				$res=$db->query($sql);
24
				$res=$db->query($sql);
26
				if (true == DB::isError($res))
25
				if (true == DB::isError($res))
27
				{
26
				{
28
					$error="true";
27
					$error="true";
Zeile 34... Zeile 33...
34
				{
33
				{
35
					$row=$res->fetchRow(DB_FETCHMODE_ASSOC);
34
					$row=$res->fetchRow(DB_FETCHMODE_ASSOC);
36
					$this->u_id=$row["u_id"];
35
					$this->u_id=$row["u_id"];
37
					$this->u_name=$row["u_name"];
36
					$this->u_name=$row["u_name"];
38
					$this->u_type=$row["u_type"];
37
					$this->u_type=$row["u_type"];
39
					$this->u_max_anz=$row["u_max_anz"];
38
					$this->u_email=$row["u_email"];
-
 
39
					$this->u_password=$row["u_password"];
40
					return $this;
40
					return $this;
41
				}
41
				}
42
			}
42
			}
43
		} 
43
		} 
Zeile 61... Zeile 61...
61
				$db_meld=$res->getUserInfo();
61
				$db_meld=$res->getUserInfo();
62
			}
62
			}
63
			return $res;
63
			return $res;
64
		}
64
		}
Zeile 65... Zeile 65...
65
 
65
 
66
		function updateUser($op, $u_id, $u_name, $u_max_anz, $u_type, $u_password)
66
		function update($u_id, $u_name, $u_email, $u_type)
67
		{
-
 
68
			global $db;
-
 
69
            $u_password=($u_password!="")?md5('$u_password'):"";
67
		{
70
			$pw_sql=", u_password='$u_password'";
68
			$this->u_name=$u_name;
71
			$op=strtoupper($op);
69
			$this->u_email=$u_email;
72
			switch($op)
-
 
73
			{
-
 
74
				case "I": $sql="INSERT INTO auth_user (u_name, u_max_anz, u_type, u_password) VALUES ('$u_name', $u_max_anz, $u_type, '$u_password')";
-
 
75
					break;
-
 
76
				case "U": $sql="UPDATE auth_user SET u_name='$u_name', u_max_anz=$u_max_anz, u_type=$u_type $pw_sql WHERE u_id=$u_id";
-
 
77
					break;
-
 
78
				case "D": $sql="DELETE FROM auth_user WHERE u_id=$u_id";
70
			$u_type=$u_type;
79
					break;
-
 
80
			}
-
 
81
			return $db->query($sql);
71
			$u_id=$u_id;
Zeile 82... Zeile 72...
82
		}
72
		}
83
 
73
 
84
	function update($u_id, $u_name, $u_max_anz, $u_type, $u_password)
-
 
85
	{
-
 
86
		$this->u_name=$u_name;
-
 
87
		$this->u_max_anz=16;
74
		function save()
-
 
75
		{
88
		$u_type=$u_type;
76
			global $db;
89
		$u_id=$u_id;
77
			$sql="UPDATE auth_user SET u_name='$this->u_name', u_email='$this->u_email', u_type=$this->u_type WHERE u_id=$this->u_id";
90
		$this->u_password=md5($password);
-
 
91
	}
78
			return $db->query($sql);
92
 
79
	}
93
	function UserData($u_name)
80
	function UserData($u_name)
94
	{
81
	{
95
		global $db, $error, $meld, $db_meld;
82
		global $db, $error, $meld, $db_meld;
Zeile 105... Zeile 92...
105
		else
92
		else
106
		{
93
		{
107
			$row=$res->fetchRow(DB_FETCHMODE_ASSOC);
94
			$row=$res->fetchRow(DB_FETCHMODE_ASSOC);
108
			$this->u_id=$row["u_id"];
95
			$this->u_id=$row["u_id"];
109
			$this->u_name=$row["u_name"];
96
			$this->u_name=$row["u_name"];
-
 
97
			$this->u_email=$row["u_email"];
110
			$this->u_type=$row["u_type"];
98
			$this->u_type=$row["u_type"];
111
			$this->u_password=$row["u_password"];
99
			$this->u_password=$row["u_password"];
112
			$this->u_max_anz=16;
-
 
113
			return $this;
100
			return $this;
114
		}
101
		}
115
	}
102
	}
116
	}
103
	}
117
?>
104
?>