This commit is contained in:
nolanwhy 2023-02-05 10:03:01 +01:00
parent 5a83ee91db
commit fc53a55c4d
3 changed files with 36 additions and 7 deletions

BIN
assets/placeholder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -75,20 +75,49 @@ $getitstarted->header();
</li>
</ul>
<div class="row row-cols-xl-6 row-cols-lg-4 row-cols-md-3 row-cols-sm-2 g-4" style="margin-left: 200px; margin-top: 1px;">
<?php $x = 40; for ($i = 1; $i <= $x; $i++) { ?>
<?php
$sql = "SELECT allStar FROM catalog";
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
$q->execute();
$numberOfItems = $q->fetchColumn();
$q = $con->prepare(str_replace('allStar', '*', $sql));
$q->execute();
if ($numberOfItems >= 1) {
while ($item = $q->fetch()) {
$qq = $con->prepare("SELECT * FROM users WHERE id = :id");
$qq->bindParam(':id', $item["creator"], PDO::PARAM_INT);
$qq->execute();
$creator = $qq->fetch();
if(!$creator) {
$creator = [
"id" => 0,
"username" => "[ unknown user ]"
];
}
$x = 40;
for ($i = 1; $i <= $x; $i++) {
?>
<div class="position-relative col">
<div class="card shadow-sm h-100">
<img src="https://tr.rbxcdn.com/7ea42f95bb986a33dbd2dc391a3ee744/420/420/Gear/Png" class="card-img-top">
<img src="<?php if (!empty($item["thumbnail"])) {echo htmlspecialchars($item["thumbnail"]);} else {echo "assets/placeholder.png";} ?>" class="card-img-top<?php if(empty($item["thumbnail"])){echo " placeholder";} ?>">
<p class="me-1 mt-1 position-absolute top-0 end-0"><?php if(rand(1, $x) == $x) { echo '<span class="badge bg-success">Limited</span>'; }; ?></p>
<span class="fs-6 mt-2 ms-2 opacity-75 position-absolute top-50 start-0 translate-middle-y bg-success badge">$1</span></img>
<span class="fs-6 mt-2 ms-2 opacity-75 position-absolute top-50 start-0 translate-middle-y bg-success badge">$<?php echo (int)htmlspecialchars($item["price"]); ?></span></img>
<div class="card-body">
<h5 class="card-title">Minion</h5>
<h5 class="card-title"><?php echo htmlspecialchars($item["name"]); ?></h5>
<p class="card-text">
By <a class="btn-link">someone</a>
By <a href="user.php?id=<?php echo (int)htmlspecialchars($creator["id"]); ?>" class="btn-link"><?php echo htmlspecialchars($creator["username"]); ?></a>
</p>
</div>
</div>
</div> <?php if ($i == $x) { break; } }?> </div>
</div>
<?php
if ($i == $x) {
break;
}
}
}
} else {
echo "no items";} ?> </div>
<br>
</div>
</main>

View File

@ -41,7 +41,7 @@ $getitstarted->header();
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 if (!empty($game["thumbnail"])) {echo htmlspecialchars($game["thumbnail"]);} else {echo "https://media.discordapp.net/attachments/1051588176805892156/1071555366887891064/placeholder.png";} ?>" class="card-img-top rounded-top<?php if(empty($game["thumbnail"])){echo " placeholder";} ?>" alt="<?php echo htmlspecialchars($game["name"]); ?>">
<img src="<?php if (!empty($game["thumbnail"])) {echo htmlspecialchars($game["thumbnail"]);} else {echo "assets/placeholder.png";} ?>" 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>