138 lines
5.9 KiB
PHP
138 lines
5.9 KiB
PHP
<?php
|
|
require 'core/config.php';
|
|
|
|
class PartyStarter {
|
|
function bootstrap() {
|
|
echo '<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js" integrity="sha384-mQ93GR66B00ZXjt0YO5KlohRA5SY2XofN4zfuZxLkoj1gXtW8ANNCe9d5Y3eG5eD" crossorigin="anonymous"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css">';
|
|
}
|
|
function header() {
|
|
// to not confuse you i renamed it from loggedoutheader to header since qzip made it both lol
|
|
require 'core/config.php';
|
|
$grubloxlogotohome = '<a class="navbar-brand text-dark" href="/"><span class="grufont fs-3">G </span><span class="gotham">GRUBLOX</span></a>';
|
|
$showhome = '';
|
|
$adminTab = " ";
|
|
if (isset($_SESSION['user'])) {
|
|
$showhome = ' <li class="nav-item text-dark" style="color: #FFFFFF;">
|
|
<a class="nav-link text-dark" href="/home"><i class="bi bi-house"></i> Home
|
|
<span class="visually-hidden">(current)</span>
|
|
</a>
|
|
</li>';
|
|
|
|
$query = $con->prepare('SELECT COUNT(id) FROM users WHERE id=:id');
|
|
$query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT);
|
|
$query->execute();
|
|
$userExists = $query->fetchColumn();
|
|
if($userExists <= 1) {
|
|
// php me when
|
|
} else {
|
|
unset($_SESSION["user"]);
|
|
}
|
|
|
|
$query = $con->prepare('SELECT * FROM users WHERE id=:id');
|
|
$query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT);
|
|
$query->execute();
|
|
|
|
// if admin
|
|
if($query->fetch(PDO::FETCH_ASSOC)["admin"] >= 1) {
|
|
$adminTab = ' <li class="nav-item">
|
|
<a class="nav-link text-dark" href="/admin"><i class="bi bi-hammer"></i> Admin</a>
|
|
</li>';
|
|
} else {
|
|
$adminTab = " ";
|
|
}
|
|
|
|
$grubloxlogotohome = '<a class="navbar-brand text-dark" href="/home"><span class="grufont fs-3">G </span><span class="gotham">GRUBLOX</span></a>';
|
|
$money = $query->fetch(PDO::FETCH_ASSOC)["money"] ?? "0";
|
|
|
|
if ($money < 1000000) {
|
|
// Anything less than a million
|
|
$money = number_format($money);
|
|
}
|
|
else if ($money < 1000000000) {
|
|
// Anything less than a billion
|
|
$money = number_format($money / 1000000, 1) . 'M';
|
|
}
|
|
else {
|
|
// At least a billion
|
|
$money = number_format($money / 1000000000, 1) . 'B';
|
|
|
|
}
|
|
|
|
// messy shit sorry mario1 fix it urself :trol:
|
|
$rightside = '
|
|
<li class="nav-item"><a class="nav-link text-dark" style="font-size: 1.1rem"><span class="grufont" style="font-size: 1.25rem">@ </span>'.$money.'</a></li>
|
|
<li class="nav-item dropdown">
|
|
<button class="nav-link border-0 text-dark dropdown-toggle bg-transparent" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<img height=32 width=32 class="rounded-5 border border-2" src="/assets/renders/user/headshot?userId='.(int)htmlspecialchars($_SESSION['user']).'">
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-lg-end">
|
|
<li><a class="nav-link ms-2" href="/user"><span class="bi bi-person-circle"></span> Profile</a></li>
|
|
<li><a class="nav-link ms-2" href="/settings"><span class="bi bi-gear"></span> Settings</a></li>
|
|
<li><a class="nav-link ms-2" href="/logout"><span class="bi bi-box-arrow-right"></span> Logout</a></li>
|
|
</ul>
|
|
</li>';
|
|
} else {
|
|
$rightside = '
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" href="/register">Register</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" href="/login">Login</a>
|
|
</li>';
|
|
}
|
|
|
|
echo '<style>
|
|
@font-face {
|
|
font-family: grufont;
|
|
src: url(/assets/font/GruFont.ttf);
|
|
}
|
|
.grufont {
|
|
font-family: grufont;
|
|
}
|
|
@font-face {
|
|
font-family: gotham;
|
|
src: url(/assets/font/GothamMedium.ttf);
|
|
}
|
|
.gotham {
|
|
font-family: gotham;
|
|
}
|
|
|
|
</style>
|
|
<link rel="stylesheet" href="/css/bootstrap.min.css"><link rel="stylesheet" href="/css/global.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js" integrity="sha384-mQ93GR66B00ZXjt0YO5KlohRA5SY2XofN4zfuZxLkoj1gXtW8ANNCe9d5Y3eG5eD" crossorigin="anonymous"></script>
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css">
|
|
<nav class="navbar navbar-expand-lg navbar-light sticky-top py-0" style="background-color: #ff7700;">
|
|
<div class="container-fluid">
|
|
' . $grubloxlogotohome . '
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor03" aria-controls="navbarColor03" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarColor03">
|
|
<ul class="navbar-nav me-auto ml-auto" style="color: #FFFFFF;">
|
|
' . $showhome . '
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" href="/games"><i class="bi bi-controller"></i> Games</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" href="/catalog"><i class="bi bi-shop"></i> Catalog</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link text-dark" href="/about"><i class="bi bi-question-circle"></i> About</a>
|
|
</li>
|
|
'.$adminTab.'
|
|
</ul>
|
|
<ul class="navbar-nav">
|
|
' . $rightside . '
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>';
|
|
}
|
|
|
|
}
|
|
?>
|