133 lines
6.3 KiB
PHP
133 lines
6.3 KiB
PHP
<?php
|
|
session_start();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html data-bs-theme="dark">
|
|
<head>
|
|
<?php
|
|
|
|
require_once 'core/classes.php';
|
|
require_once 'core/classes/user.php';
|
|
if(isset($_SESSION['user'])) {
|
|
$user = new User($con, $_SESSION['user']);
|
|
} else {
|
|
echo ''; // fuck you
|
|
}
|
|
$getitstarted = new PartyStarter;
|
|
$getitstarted->header();
|
|
?>
|
|
</head>
|
|
<title><?php echo $sitename; ?> | games</title>
|
|
<body>
|
|
<main class="container" style="width: 100%; float: left; margin-left: 20px">
|
|
<br>
|
|
<br>
|
|
<h4 class="text-white card-title">Popular</h4>
|
|
<div id="games-popular" class="carousel carousel-dark slide">
|
|
<div class="carousel-inner">
|
|
<div class="carousel-item active">
|
|
<div class="card-group" style=" margin-top: 15px; width: 100%;">
|
|
<?php
|
|
$sql = "SELECT allStar FROM games";
|
|
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
|
|
$q->execute();
|
|
$numberOfGames = $q->fetchColumn();
|
|
$q = $con->prepare(str_replace('allStar', '*', $sql));
|
|
$q->execute();
|
|
if ($numberOfGames >= 1) {
|
|
while ($game = $q->fetch()) {
|
|
$playingCount = 69;
|
|
$x = 8;
|
|
for ($i = 1; $i <= $x; $i++) { ?>
|
|
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
|
|
<a href="game?id=<?php echo (int)htmlspecialchars($game["id"]); ?>" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
|
|
<img src="<?php echo htmlspecialchars($game["thumbnail"]); ?>" class="card-img-top rounded-top<?php if(empty($game["thumbnail"])){echo " placeholder";} ?>" alt="<?php echo htmlspecialchars($game["name"]); ?>">
|
|
<div class="card-body">
|
|
<small class="card-title text-white" style="font-size: 1rem;"><?php echo htmlspecialchars($game["name"]); ?></small>
|
|
<br>
|
|
<small class="card-text text-muted"><?php echo (int)$playingCount; ?> playing</small>
|
|
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
|
|
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
|
|
</div>
|
|
<i class="bi bi-hand-thumbs-up-fill text-secondary" style="font-size: 1rem; float: left; margin-top: -8px;"></i>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
if ($i == $x) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
echo "no games";} ?>
|
|
</div>
|
|
</div>
|
|
<div class="carousel-item"><div class="card-group" style=" margin-top: 15px; width: 100%;">
|
|
</div></div>
|
|
<div class="carousel-item"></div>
|
|
</div>
|
|
<button class="carousel-control-prev my-auto" type="button" data-bs-target="#games-popular" data-bs-slide="prev" style="width: 35px; height: 10%;">
|
|
<span class="bi bi-caret-left-fill" aria-hidden="true" data-bs-theme="dark" style="margin-left: 10px; font-size: 2.5rem"></span>
|
|
</button>
|
|
<button class="carousel-control-next my-auto" type="button" data-bs-target="#games-popular" data-bs-slide="next" style="width: 35px; height: 10%;">
|
|
<span class="bi bi-caret-right-fill" aria-hidden="true" data-bs-theme="dark" style="margin-right: 30px; font-size: 2.5rem"></span>
|
|
</button>
|
|
</div>
|
|
|
|
<br>
|
|
<h4 class="text-white card-title">Most played</h4>
|
|
<div id="games-most-played" class="carousel carousel-dark slide">
|
|
<div class="carousel-inner">
|
|
<div class="carousel-item active">
|
|
<div class="card-group" style=" margin-top: 15px; width: 100%;">
|
|
<?php
|
|
$sql = "SELECT allStar FROM games";
|
|
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
|
|
$q->execute();
|
|
$numberOfGames = $q->fetchColumn();
|
|
$q = $con->prepare(str_replace('allStar', '*', $sql));
|
|
$q->execute();
|
|
if ($numberOfGames >= 1) {
|
|
while ($game = $q->fetch()) {
|
|
$playingCount = 69;
|
|
$x = 8;
|
|
for ($i = 1; $i <= $x; $i++) { ?>
|
|
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
|
|
<a href="game?id=<?php echo (int)htmlspecialchars($game["id"]); ?>" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
|
|
<img src="<?php echo htmlspecialchars($game["thumbnail"]); ?>" class="card-img-top rounded-top<?php if(empty($game["thumbnail"])){echo " placeholder";} ?>" alt="<?php echo htmlspecialchars($game["name"]); ?>">
|
|
<div class="card-body">
|
|
<small class="card-title text-white" style="font-size: 1rem;"><?php echo htmlspecialchars($game["name"]); ?></small>
|
|
<br>
|
|
<small class="card-text text-muted"><?php echo (int)$playingCount; ?> playing</small>
|
|
<div class="progress rounded-4 border border-secondary" style="margin-left: 20px; margin-top: 10px; margin-bottom: -10px; height: 8px; background: none;">
|
|
<div class="progress-bar bg-secondary" role="progressbar" aria-label="Segment one" style="width: 21.5%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
|
|
</div>
|
|
<i class="bi bi-hand-thumbs-up-fill text-secondary" style="font-size: 1rem; float: left; margin-top: -8px;"></i>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<?php
|
|
if ($i == $x) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
echo "no games";} ?>
|
|
</div>
|
|
</div>
|
|
<div class="carousel-item"><div class="card-group" style=" margin-top: 15px; width: 100%;">
|
|
</div></div>
|
|
<div class="carousel-item"></div>
|
|
</div>
|
|
<button class="carousel-control-prev my-auto" type="button" data-bs-target="#games-most-played" data-bs-slide="prev" style="width: 35px; height: 10%;">
|
|
<span class="bi bi-caret-left-fill" aria-hidden="true" data-bs-theme="dark" style="margin-left: 10px; font-size: 2.5rem"></span>
|
|
</button>
|
|
<button class="carousel-control-next my-auto" type="button" data-bs-target="#games-most-played" data-bs-slide="next" style="width: 35px; height: 10%;">
|
|
<span class="bi bi-caret-right-fill" aria-hidden="true" data-bs-theme="dark" style="margin-right: 30px; font-size: 2.5rem"></span>
|
|
</button>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|