Subversion-Projekte lars-tiefland.em_wm

Revision

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

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