You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
945 B
47 lines
945 B
|
3 years ago
|
<?php
|
||
|
|
|
||
|
|
session_start();
|
||
|
|
|
||
|
|
ini_set("display_errors", "1");
|
||
|
|
ini_set("display_startup_errors", "1");
|
||
|
|
error_reporting(E_ALL);
|
||
|
|
|
||
|
|
if (isset($_SESSION["user_id"])) {
|
||
|
|
|
||
|
|
$mysqli = include __DIR__ . "/../database.php";
|
||
|
|
|
||
|
|
$sql = "SELECT * FROM user
|
||
|
|
WHERE id = {$_SESSION["user_id"]}";
|
||
|
|
|
||
|
|
$result = $mysqli->query($sql);
|
||
|
|
|
||
|
|
$user = $result->fetch_assoc();
|
||
|
|
}
|
||
|
|
|
||
|
|
?>
|
||
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<title>Home</title>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
|
||
|
|
<h1>Home</h1>
|
||
|
|
|
||
|
|
<?php if (isset($user)): ?>
|
||
|
|
|
||
|
|
<p>Hello <?= htmlspecialchars($user["name"]) ?></p>
|
||
|
|
|
||
|
|
<p><a href="../logout.php">Log out</a></p>
|
||
|
|
|
||
|
|
<?php else: ?>
|
||
|
|
|
||
|
|
<p><a href="../login.php">Log in</a> or <a href="../signup.html">sign up</a></p>
|
||
|
|
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
</body>
|
||
|
|
</html>
|