| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/konzalta/soko.chat/ |
Upload File : |
<?php
require_once __DIR__ . '/app/db.php';
require_once __DIR__ . '/app/helpers.php';
$countySlug = $_GET['county'] ?? '';
$categorySlug = $_GET['category'] ?? '';
$stmt = $pdo->prepare("SELECT * FROM counties WHERE slug=? LIMIT 1");
$stmt->execute([$countySlug]); $county = $stmt->fetch();
$stmt = $pdo->prepare("SELECT * FROM categories WHERE slug=? LIMIT 1");
$stmt->execute([$categorySlug]); $category = $stmt->fetch();
if (!$county || !$category) { http_response_code(404); die('Page not found.'); }
$stmt = $pdo->prepare("SELECT d.* FROM deals d WHERE d.county_id=? AND d.category_id=? AND d.status='published' ORDER BY d.created_at DESC LIMIT 100");
$stmt->execute([$county['id'], $category['id']]);
$deals = $stmt->fetchAll();
?>
<!doctype html><html><head><meta charset="utf-8"><title><?= e($category['name']) ?> in <?= e($county['name']) ?> - <?= e(APP_NAME) ?></title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="<?= e(APP_URL) ?>/assets/css/style.css"></head>
<body>
<div class="top"><div class="wrap"><a class="brand logo-brand" href="<?= e(APP_URL) ?>/"><img class="logo-img" src="<?= e(APP_URL) ?>/assets/img/soko-logo.png" alt="Soko.chat"></a><span class="tag"> <?= e(strtolower($category['name'])) ?> in <?= e(strtolower($county['name'])) ?></span><div class="nav"><a href="<?= e(county_url($county['slug'])) ?>">back to county</a><a href="<?= e(APP_URL) ?>/submit.php?county=<?= e($county['slug']) ?>&category=<?= e($category['slug']) ?>">post</a></div></div></div>
<div class="wrap">
<h2><?= e($category['name']) ?> - <?= e($county['name']) ?></h2>
<div class="deal-list">
<?php foreach ($deals as $deal): ?>
<div class="deal-row">
<a class="deal-title" href="<?= e(APP_URL) ?>/deal.php?slug=<?= e($deal['slug']) ?>"><?= e($deal['title']) ?></a>
<div class="muted"><?= e($deal['location']) ?> ยท <?= e($deal['created_at']) ?></div>
<?php if ($deal['price']): ?><div class="price"><?= e($deal['price']) ?></div><?php endif; ?>
<div><?= nl2br(e(mb_strimwidth($deal['redacted_summary'],0,180,'...'))) ?></div>
</div>
<?php endforeach; ?>
<?php if (!$deals): ?><div class="deal-row">No listings yet. <a href="<?= e(APP_URL) ?>/submit.php?county=<?= e($county['slug']) ?>&category=<?= e($category['slug']) ?>">Post one free</a>.</div><?php endif; ?>
</div>
</div>
</body></html>