| 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'] ?? '';
$stmt = $pdo->prepare("SELECT * FROM counties WHERE slug=? AND status='active' LIMIT 1");
$stmt->execute([$countySlug]);
$county = $stmt->fetch();
if (!$county) { http_response_code(404); die('County not found.'); }
$categories = $pdo->query("SELECT * FROM categories WHERE status='active' ORDER BY sort_order ASC")->fetchAll();
$stmt = $pdo->prepare("SELECT cat.*, COUNT(d.id) deal_count
FROM categories cat
LEFT JOIN deals d ON d.category_id=cat.id AND d.county_id=? AND d.status='published'
WHERE cat.status='active'
GROUP BY cat.id
ORDER BY cat.sort_order ASC");
$stmt->execute([$county['id']]);
$categoryCounts = $stmt->fetchAll();
$stmt = $pdo->prepare("SELECT d.*, cat.name category_name
FROM deals d
LEFT JOIN categories cat ON cat.id=d.category_id
WHERE d.county_id=? AND d.status='published'
ORDER BY d.created_at DESC
LIMIT 50");
$stmt->execute([$county['id']]);
$deals = $stmt->fetchAll();
?>
<!doctype html><html><head><meta charset="utf-8"><title><?= e($county['name']) ?> Deals - <?= 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($county['name'])) ?></span><div class="nav"><a href="<?= e(APP_URL) ?>/submit.php?county=<?= e($county['slug']) ?>">post a deal free</a></div></div></div>
<div class="wrap layout">
<aside class="panel"><h3><?= e(strtolower($county['name'])) ?> categories</h3><?php foreach ($categoryCounts as $cat): ?><a href="<?= e(category_url($county['slug'], $cat['slug'])) ?>"><?= e(strtolower($cat['name'])) ?> <span class="muted">(<?= e($cat['deal_count']) ?>)</span></a><br><?php endforeach; ?></aside>
<main>
<div class="panel"><h2><?= e($county['name']) ?> classifieds</h2><p class="muted">Deals, leads, rentals, jobs and opportunities in <?= e($county['name']) ?> County.</p></div>
<h3>latest in <?= e(strtolower($county['name'])) ?></h3>
<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['category_name']) ?> · <?= e($deal['location']) ?> · <?= e($deal['created_at']) ?></div>
<?php if ($deal['price']): ?><div class="price"><?= e($deal['price']) ?></div><?php endif; ?>
<span class="muted">views <?= e((int)$deal['views_count']) ?> · unlocks <?= e((int)$deal['unlocks_count']) ?></span>
</div>
<?php endforeach; ?>
<?php if (!$deals): ?><div class="deal-row">No deals yet in <?= e($county['name']) ?>. <a href="<?= e(APP_URL) ?>/submit.php?county=<?= e($county['slug']) ?>">Post the first one free</a>.</div><?php endif; ?>
</div>
</main>
<aside class="panel"><h3>nearby idea</h3><p>Start with rentals, gigs and business stock. Those move fastest.</p></aside>
</div>
</body></html>