-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
39 lines (29 loc) · 804 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
<?php
session_start();
// print_r($_SESSION);
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 Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/index.css">
</head>
<body>
<h1>Home Page</h1>
<?php if(isset($user)): ?>
<p>Hello, <?= htmlspecialchars($user["username"]); ?>. You are now logged In.</p>
<p><a href="logout.php">LogOut</a></p>
<?php else: ?>
<p><a href="login.php">LogIn</a> or <a href="signup.php">SignUp</a></p>
<?php endif; ?>
</body>
</html>