Revision 39 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?class User{var $u_id;var $u_name;var $u_password;var $u_type;var $u_max_anz;function User($user, $password){global $db, $db_meld, $error, $meld;if ($user==""){$this->u_name="";$this->u_type=0;$this->u_max_anz=10;$this->u_passsword=md5("");}else{$this->u_name=$user;$this->u_password=md5($password);$sql="SELECT * FROM auth_user WHERE u_name='".$this->u_name."' AND u_password='".$this->u_password."'";$res=$db->query($sql);if (true == DB::isError($res)){$error="true";$meld="Ein Fehler ist aufgetreten!";$db_meld=$res->getUserInfo();return $error;}else{$row=$res->fetchRow(DB_FETCHMODE_ASSOC);$this->u_id=$row["u_id"];$this->u_type=$row["u_type"];$this->u_max_anz=$row["u_max_anz"];return $this;}}}function UserListe($limit, $start=0){$sql="SELECT * FROM auth_user";global $db, $meld, $db_meld, $error;if ($db->provides('limit') && $limit > 0){$res=$db->limitquery($sql, $start, $limit);}else{$res=$db->query($sql);}if (true == DB::isError($res)){$error=true;$meld="Ein Fehler ist aufgetreten!";$db_meld=$res->getUserInfo();}return $res;}function updateUser($op, $u_id, $u_name, $u_max_anz, $u_type, $u_password){global $db;$u_password=($u_password!="")?md5('$u_password'):"";$pw_sql=", u_password='$u_password'";$op=strtoupper($op);switch($op){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')";break;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";break;case "D": $sql="DELETE FROM auth_user WHERE u_id=$u_id";break;}return $db->query($sql);}}function updateUserPassword($password){$this->u_password=md5($password);}?>