░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
lon105.truehost.cloud
LOCATION:
/home/ilrtztmy/vgcproperty.com/api/public
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: properties.php
<?php // api/public/properties.php (PUBLIC — no auth required) // GET → Property[] (Available listings only, newest first) // GET ?type= → Property[] (filtered by type) // GET ?id= → Property (single Available property) declare(strict_types=1); require_once __DIR__ . '/../admin/cors.php'; require_once __DIR__ . '/../admin/db.php'; require_once __DIR__ . '/../admin/auth_middleware.php'; // abort() / json_out() helpers if ($_SERVER['REQUEST_METHOD'] !== 'GET') { abort(405, 'Method not allowed'); } $pdo = db(); function format_public_property(array $row): array { return [ 'id' => $row['id'], 'title' => $row['title'], 'location' => $row['location'], 'type' => $row['type'], 'price' => $row['price'], 'status' => $row['status'], 'description' => $row['description'], 'images' => json_decode($row['images'] ?: '[]', true), 'features' => json_decode($row['features'] ?: '[]', true), 'views' => (int)$row['views'], 'createdAt' => $row['created_at'], ]; } $allowed_types = ['Residential', 'Commercial', 'Mixed-Use', 'Off-Plan']; // Single property if (!empty($_GET['id'])) { $stmt = $pdo->prepare("SELECT * FROM properties WHERE id = ? AND status = 'Available' LIMIT 1"); $stmt->execute([$_GET['id']]); $row = $stmt->fetch(); if (!$row) abort(404, 'Property not found'); json_out(format_public_property($row)); } // Filtered list if (!empty($_GET['type']) && in_array($_GET['type'], $allowed_types, true)) { $stmt = $pdo->prepare("SELECT * FROM properties WHERE status = 'Available' AND type = ? ORDER BY created_at DESC"); $stmt->execute([$_GET['type']]); json_out(array_map('format_public_property', $stmt->fetchAll())); } // Full list (Available only) $rows = $pdo->query("SELECT * FROM properties WHERE status = 'Available' ORDER BY created_at DESC")->fetchAll(); json_out(array_map('format_public_property', $rows));
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 leadership.php
PHP
694 B
2026-05-16 15:25
EDIT
📄 properties.php
PHP
2 KB
2026-05-16 15:25
EDIT
📄 services.php
PHP
692 B
2026-05-16 15:25
EDIT