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