parent
2b83b767ca
commit
669ce27c59
@ -0,0 +1,46 @@
|
|||||||
|
<?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>
|
||||||
Loading…
Reference in new issue