-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
53 lines (27 loc) · 890 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
if (isset($_SESSION["user_id"])) {
$mysqli = require __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>