125 lines
4.9 KiB
PHP
125 lines
4.9 KiB
PHP
<?php
|
|
session_start();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en" 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']);
|
|
}
|
|
$getitstarted = new PartyStarter;
|
|
$getitstarted->header();
|
|
?> </head>
|
|
<title><?php echo $pagename; ?> | <?php echo $sitename; ?></title>
|
|
<body>
|
|
<main class="container" style="width: 100%;">
|
|
<br>
|
|
<br>
|
|
<form role="search" class="float-end" style="width: 45%;">
|
|
<div class="input-group mb-3 shadow-sm">
|
|
<input class="form-control rounded-end-0" type="search" placeholder="Search an item..." name="search" aria-label="Search">
|
|
<button id="search" type="submit" class="btn btn-primary rounded-start-0">Search</button>
|
|
</div>
|
|
</form>
|
|
<h2>Catalog</h2>
|
|
<hr>
|
|
<ul class="list-group float-start shadow-sm" style="width: 12rem;">
|
|
<li class="list-group-item text-bg-secondary" aria-current="true">
|
|
<small>Browse by</small>
|
|
<br>
|
|
<h4>Category</h4>
|
|
</li>
|
|
<a href="/catalog" class="list-group-item active" aria-current="true">All categories</a>
|
|
<a href="?p=1" class="list-group-item">Hats</a>
|
|
<a href="?p=2" class="list-group-item">Shirts</a>
|
|
<a href="?p=3" class="list-group-item">Pants</a>
|
|
<a href="?p=4" class="list-group-item">Gears</a>
|
|
<a href="?p=5" class="list-group-item">Packages</a>
|
|
<button class="list-group-item text-start" type="button" data-bs-toggle="dropdown" aria-expanded="false">Body parts</button>
|
|
<ul class="dropdown-menu">
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=1">Heads</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=2">Torso</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=3">Left arm</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=4">Right arm</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=5">Left leg</a>
|
|
</li>
|
|
<li>
|
|
<a class="dropdown-item" href="?bp=6">Right leg</a>
|
|
</li>
|
|
</ul>
|
|
<li class="list-group-item">
|
|
<h5>Legend</h5>
|
|
<span class="badge bg-success" style="width: 3.5rem;">Limited</span>
|
|
<br>
|
|
<p class="text-white">Limited Items </p>
|
|
<p>Owners of these discontinued items can re-sell them to other users at any price.</p>
|
|
<div class="pt-2"></div>
|
|
<span class="badge bg-success" style="width: 4.5rem;">Limited <span class="badge bg-danger" style="width: 1.1rem;">U</span>
|
|
</span>
|
|
<br>
|
|
<p class="text-white">Limited Unique Items</p>
|
|
<p>A limited supply originally sold by <?php echo $sitename; ?>. Each unit is labeled with a serial number. Once sold out, owners can re-sell them to other users. </p>
|
|
</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
|
|
$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">
|
|
<a href="item.php?id="><img src="<?php if (!empty($item["thumbnail"])) {echo htmlspecialchars($item["thumbnail"]);} else {echo "assets/placeholder.png";} ?>" class="card-img-top"></a>
|
|
<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">$<?php echo (int)htmlspecialchars($item["price"]); ?></span></img>
|
|
<div class="card-body">
|
|
<h5 class="card-title"><?php echo htmlspecialchars($item["name"]); ?></h5>
|
|
<p class="card-text">
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
echo "no items";} ?> </div>
|
|
<br>
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|