shopping-list/php/classes.user.php
2018-11-09 13:21:34 +01:00

15 lines
561 B
PHP

<?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"];
}
}
?>