diff --git a/catalog.php b/catalog.php index ee8b42a..d40ced1 100644 --- a/catalog.php +++ b/catalog.php @@ -62,12 +62,12 @@ $getitstarted->header();
Limited Items
Owners of these discontinued items can re-sell them to other users at any price.
- Limited U + Limited ULimited Unique Items
@@ -80,27 +80,36 @@ $getitstarted->header(); $q = $con->prepare(str_replace('allStar', 'count(*)', $sql)); $q->execute(); $numberOfItems = $q->fetchColumn(); + $sql = "SELECT allStar FROM catalog LIMIT :limit OFFSET :offset"; + $page = $_GET['p'] ?? 0; + $limit = 20; + $lpage = $limit*$page; $q = $con->prepare(str_replace('allStar', '*', $sql)); + $q->bindParam(':limit', $limit, PDO::PARAM_INT); + $q->bindParam(':offset', $lpage, PDO::PARAM_INT); $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 = [ + foreach ($q->fetchAll() as $item) { + $query = $con->prepare('SELECT COUNT(id) FROM users WHERE id=:id'); + $query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT); + $query->execute(); + $userExists = $query->fetchColumn(); + if($userExists <= 1) { + $creator = [ + "id" => $_SESSION['user'], + "username" => $item["name"] + ]; + } else { + $creator = [ "id" => 0, "username" => "[ unknown user ]" - ]; - } - $x = 40; - for ($i = 1; $i <= $x; $i++) { + ]; + } ?>Limited'; }; ?>
+Limited'; }; ?>
$