mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-27 23:40:03 +01:00
implemented user class
This commit is contained in:
parent
84729d5912
commit
28e7d78de1
2 changed files with 20 additions and 8 deletions
|
@ -2,19 +2,16 @@
|
||||||
<link rel="stylesheet" href="/style/settings.css">
|
<link rel="stylesheet" href="/style/settings.css">
|
||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
<?php
|
<?php
|
||||||
include $_SESSION["docroot"].'/php/connect.php';
|
include $_SESSION["docroot"].'/php/classes.user.php';
|
||||||
$token = $_COOKIE["token"];
|
$user = new user($_COOKIE["token"]);
|
||||||
$query = "SELECT username, email, last_login FROM `users` WHERE `uid` = (SELECT user FROM `sessions` WHERE `session_id` = \"$token\")";
|
|
||||||
$result = $mysqli->query($query);
|
|
||||||
$user = $result->fetch_assoc();
|
|
||||||
?>
|
?>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<h2>User</h2>
|
<h2>User</h2>
|
||||||
<div class="userprofile-pane pane">
|
<div class="userprofile-pane pane">
|
||||||
<div class="userprofile">
|
<div class="userprofile">
|
||||||
<span><font class="attribute">Benutzername</font><input class="change-attribute-input" id="username-input" type="text" name="username" placeholder="<?php echo $user["username"]; ?>"></span>
|
<span><font class="attribute">Benutzername</font><input class="change-attribute-input" id="username-input" type="text" name="username" placeholder="<?php echo $user->username; ?>"></span>
|
||||||
<span><font class="attribute">Email</font><input class="change-attribute-input" id="mail-input" type="email" name="username" placeholder="<?php echo $user["email"]; ?>"></span>
|
<span><font class="attribute">Email</font><input class="change-attribute-input" id="mail-input" type="email" name="username" placeholder="<?php echo $user->email; ?>"></span>
|
||||||
<span><font class="attribute">Letzter Login</font><font><?php echo $user["last_login"]; ?></font></span>
|
<span><font class="attribute">Letzter Login</font><font><?php echo $user->last_login; ?></font></span>
|
||||||
</div>
|
</div>
|
||||||
<button class="button" id="userSaveButton">Speichern</button>
|
<button class="button" id="userSaveButton">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
15
php/classes.user.php
Normal file
15
php/classes.user.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
Class user {
|
||||||
|
public $uid, $username, $email, $last_login;
|
||||||
|
function user($session_id) {
|
||||||
|
include $_SESSION["docroot"].'/php/connect.php';
|
||||||
|
$query = "SELECT uid, username, email, last_login FROM `users` WHERE `uid` = (SELECT user FROM `sessions` WHERE `session_id` = \"$session_id\")";
|
||||||
|
$result = $mysqli->query($query);
|
||||||
|
$user = $result->fetch_assoc();
|
||||||
|
$this->uid = $user["uid"];
|
||||||
|
$this->username = $user["username"];
|
||||||
|
$this->email = $user["email"];
|
||||||
|
$this->last_login = $user["last_login"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in a new issue