-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
39 lines (38 loc) · 1.38 KB
/
user.php
File metadata and controls
39 lines (38 loc) · 1.38 KB
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();
$loggedIn = isset($_SESSION['user']);
$user = $loggedIn ? $_SESSION['user'] : null;
$container = gethostname();
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>User</title>
<style>
body { font-family: sans-serif; display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: #f4f4f4; }
main { flex: 1; display: flex; justify-content: center; align-items: center; }
.box { background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.1); width: 320px; text-align: center; }
h1 { margin-top: 0; font-size: 1.25rem; }
a { display: inline-block; margin-top: 1rem; color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
footer { background: #1f2937; color: #fff; text-align: center; padding: .75rem; font-size: .85rem; font-family: monospace; }
</style>
</head>
<body>
<main>
<div class="box">
<?php if ($loggedIn): ?>
<h1>Hello <?= htmlspecialchars($user) ?></h1>
<a href="logout.php">Logout</a>
<?php else: ?>
<h1>Anda belum login</h1>
<a href="index.php">Login</a>
<?php endif; ?>
</div>
</main>
<footer>
Container: <?= htmlspecialchars($container) ?>
</footer>
</body>
</html>