Update classes.php

This commit is contained in:
Mario 2023-01-25 22:06:56 +02:00 committed by GitHub
parent 4a93e2a541
commit d0d3e8fde5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 18 deletions

View File

@ -6,32 +6,33 @@ session_start();
require('core/config.php');
class PartyStarter {
// creates header
function header()
{
echo "test";
}
function bootstrap() {
echo '<link rel="stylesheet" href="css/bootstrap.min.css">';
}
function buildloggedoutheader() {
function header() {
// to not confuse you i renamed it from loggedoutheader to header since qzip made it both lol
require('core/config.php');
$showhome = '';
if(isset($_SESSION['user'])) {
$showhome = ' <li class="nav-item" style="color: #FFFFFF;">
<a class="nav-link active" href="/home">Home
<span class="visually-hidden">(current)</span>
</a>
</li>';
$query = $con->prepare('SELECT money FROM users WHERE id=:id');
$query->bindParam(':id', $id);
$query->execute();
$money = $query->fetch(PDO::FETCH_ASSOC)["money"];
$currencyIcon = "$";
$query->execute();
$money = $query->fetch(PDO::FETCH_ASSOC)["money"] ?? "-0";
if ($money < 1000000) {
// Anything less than a million
$money = $currencyIcon.number_format($money);
$money = number_format($money);
} else if ($money < 1000000000) {
// Anything less than a billion
$money = $currencyIcon.number_format($money / 1000000, 1) . 'M';
$money = number_format($money / 1000000, 1) . 'M';
} else {
// At least a billion
$money = $currencyIcon.number_format($money / 1000000000, 1) . 'B';
$money = number_format($money / 1000000000, 1) . 'B';
}
// messy shit sorry mario1 fix it urself :trol:
@ -58,11 +59,7 @@ class PartyStarter {
</button>
<div class="collapse navbar-collapse" id="navbarColor03">
<ul class="navbar-nav me-auto ml-auto" style="color: #FFFFFF;">
<li class="nav-item" style="color: #FFFFFF;">
<a class="nav-link active" href="/home">Home
<span class="visually-hidden">(current)</span>
</a>
</li>
' . $showhome . '
<li class="nav-item">
<a class="nav-link" href="/games">Games</a>
</li>
@ -85,4 +82,4 @@ class PartyStarter {
}
?>
?>