id/header.php

39 lines
1 KiB
PHP
Raw Normal View History

2023-06-07 20:40:38 +01: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
if (!isset($_SESSION['auth'])) goto skip_auth;
if ($_SESSION['auth']) {
$sql = "SELECT display_name FROM accounts WHERE id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$_SESSION['id']]);
$name = $stmt->fetchColumn();
}
if ($name == '') {
$name = '<code class=bcid>'.format_bcid($_SESSION['id']).'</code>';
}
skip_auth:
?>
2023-06-07 20:40:38 +01:00
<link rel="stylesheet" href="./styles/global.css">
<link rel="stylesheet" href="./fontawesome/css/all.css">
<header>
<div class="start">
<a href="/" id="sitetitle"><span class="bc-1">Bye</span><span class="bc-2">Corps</span><span class="bc-3"> ID</span></a></div>
<div class="end">
2023-11-06 16:38:18 +00:00
<?php if (!isset($_SESSION['auth'])) goto signed_out; ?>
2023-06-07 20:40:38 +01:00
<div class="loggedin">
2023-11-06 16:38:18 +00:00
<a href="/account" class="account">Hey there, <?= $name ?>! <i class="fa-solid fa-fw fa-angle-right"></i></a>
2023-06-07 20:40:38 +01:00
</div>
2023-11-06 16:38:18 +00:00
<?php signed_out: ?>
2023-06-07 20:40:38 +01:00
</div>
</header>