id/header.php

40 lines
975 B
PHP
Raw Normal View History

2023-06-07 19:40:38 +00:00
<!-- This is a testing file for the header used on BCID. Copy of header on ByeCorps.com -->
2023-11-06 16:38:18 +00:00
<?php
2023-11-19 12:24:38 +00:00
if (!$_SESSION['auth']) goto skip_auth;
2023-11-06 16:38:18 +00:00
if ($_SESSION['auth']) {
$sql = "SELECT display_name FROM accounts WHERE id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$_SESSION['id']]);
$name = $stmt->fetchColumn();
}
2023-11-19 12:24:38 +00:00
if (empty($name)) {
2023-11-06 16:38:18 +00:00
$name = '<code class=bcid>'.format_bcid($_SESSION['id']).'</code>';
}
skip_auth:
?>
2023-11-19 12:24:38 +00:00
2023-06-07 19:40:38 +00:00
<header>
<div class="start">
2023-11-19 12:24:38 +00:00
<a href="/" id="sitetitle">
<span class="bc-1">Bye</span><span class="bc-2">Corps</span><span class="bc-3"> ID</span>
</a></div>
2023-06-07 19:40:38 +00:00
<div class="end">
2023-11-06 16:38:18 +00:00
2023-11-19 12:24:38 +00:00
<?php if (!$_SESSION['auth']) goto signed_out; ?>
<?php if ($user['is_admin']) echo "<a href='/admin'>Admin panel</a>"; ?>
2023-06-07 19:40:38 +00:00
<div class="loggedin">
2023-11-19 12:24:38 +00:00
<a href="/account" class="account">Hey there, <?= $name ?>!</a>
2023-06-07 19:40:38 +00:00
</div>
2023-11-06 16:38:18 +00:00
<?php signed_out: ?>
2023-06-07 19:40:38 +00:00
</div>
</header>