403Webshell
Server IP : 72.60.21.38  /  Your IP : 216.73.217.154
Web Server : LiteSpeed
System : Linux uk-fast-web1372.main-hosting.eu 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User : u390967363 ( 390967363)
PHP Version : 8.2.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/u390967363/domains/aibenproperties.com/public_html/app/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/u390967363/domains/aibenproperties.com/public_html/app/plot-upload.php
<?php
require 'includes/header.php';
require_once 'includes/db.php';
require_once 'includes/functions.php';
if (session_status() === PHP_SESSION_NONE) { session_start(); }
$role = $_SESSION['user_role'] ?? 'guest';
if (!isAdminTier($role)) { header('Location: properties.php'); exit; }
ensurePropertyPhasesTable();
$companyId = getCurrentCompanyId();
$props = [];
try {
    $sql = "SELECT id, title FROM properties WHERE type = 'land'";
    $params = [];
    if ($companyId && function_exists('tableHasColumn') && tableHasColumn('properties','company_id')) {
        $sql .= " AND company_id = ?";
        $params[] = $companyId;
    }
    $st = $pdo->prepare($sql);
    $st->execute($params);
    $props = $st->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {}
$phases = [];
if (isset($_GET['property_id']) && $_GET['property_id'] !== '') {
    try {
        $ps = $pdo->prepare("SELECT id, name FROM property_phases WHERE property_id = ? ORDER BY order_index ASC");
        $ps->execute([(int)$_GET['property_id']]);
        $phases = $ps->fetchAll(PDO::FETCH_ASSOC);
    } catch (Exception $e) {}
}
$notice = null; $alert = null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $propertyId = (int)($_POST['property_id'] ?? 0);
    $phaseId = $_POST['phase_id'] !== '' ? (int)$_POST['phase_id'] : null;
    $rows = [];
    if (isset($_POST['plot_block'])) {
        $blocks = $_POST['plot_block'];
        $nums = $_POST['plot_number'] ?? [];
        $sizes = $_POST['plot_size'] ?? [];
        $coords = $_POST['plot_coords'] ?? [];
        for ($i=0; $i<count($nums); $i++) {
            $n = trim($nums[$i] ?? '');
            $s = (float)($sizes[$i] ?? 0);
            if ($n === '' || $s <= 0) continue;
            $rows[] = [
                'block' => trim($blocks[$i] ?? ''),
                'plot_number' => $n,
                'size_sqm' => $s,
                'coordinates' => trim($coords[$i] ?? '')
            ];
        }
    }
    $res = createPlotsBulk($propertyId, $phaseId, $rows);
    if ($res['ok'] ?? false) { $notice = 'Plots uploaded successfully'; }
    else { $alert = $res['msg'] ?? 'Upload failed'; }
}
?>
<div class="container-fluid px-4 py-4">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h1 class="h4 fw-bold text-primary">Upload Plots</h1>
            <div class="text-muted small">Add physical plots for a land property</div>
        </div>
        <a href="properties.php" class="btn btn-light">Back</a>
    </div>
    <?php if ($notice): ?><div class="alert alert-success"><?= htmlspecialchars($notice) ?></div><?php endif; ?>
    <?php if ($alert): ?><div class="alert alert-danger"><?= htmlspecialchars($alert) ?></div><?php endif; ?>
    <form method="post" class="card border-0 shadow-sm">
        <div class="card-body p-4">
            <div class="row g-3 mb-3">
                <div class="col-md-6">
                    <label class="form-label fw-bold">Property</label>
                    <select name="property_id" class="form-select" required onchange="location.href='plot-upload.php?property_id='+this.value">
                        <option value="">Select property...</option>
                        <?php foreach ($props as $p): ?>
                            <option value="<?= $p['id'] ?>" <?= (isset($_GET['property_id']) && (int)$_GET['property_id']===(int)$p['id'])?'selected':'' ?>><?= htmlspecialchars($p['title']) ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="col-md-6">
                    <label class="form-label fw-bold">Phase (optional)</label>
                    <select name="phase_id" class="form-select">
                        <option value="">None</option>
                        <?php foreach ($phases as $ph): ?>
                            <option value="<?= $ph['id'] ?>"><?= htmlspecialchars($ph['name']) ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>
            <div id="plotsWrap">
                <div class="row g-2 align-items-end mb-2 plot-row">
                    <div class="col-md-2">
                        <label class="form-label">Block</label>
                        <input type="text" name="plot_block[]" class="form-control" placeholder="e.g., A">
                    </div>
                    <div class="col-md-3">
                        <label class="form-label">Plot Number</label>
                        <input type="text" name="plot_number[]" class="form-control" required>
                    </div>
                    <div class="col-md-3">
                        <label class="form-label">Plot Size (SQM)</label>
                        <input type="number" step="0.01" name="plot_size[]" class="form-control" required>
                    </div>
                    <div class="col-md-3">
                        <label class="form-label">Coordinates (optional)</label>
                        <input type="text" name="plot_coords[]" class="form-control">
                    </div>
                    <div class="col-md-1 d-grid">
                        <button type="button" class="btn btn-outline-danger" data-plot-remove>&times;</button>
                    </div>
                </div>
            </div>
            <button type="button" class="btn btn-outline-primary btn-sm" id="addRowBtn">Add Row</button>
        </div>
        <div class="card-footer bg-white text-end">
            <button type="submit" class="btn btn-primary"><i class="fa-solid fa-upload me-2"></i>Upload Plots</button>
        </div>
    </form>
</div>
<script>
document.addEventListener('click', function(e){
    if (e.target && e.target.id === 'addRowBtn') {
        var wrap = document.getElementById('plotsWrap');
        var row = document.createElement('div');
        row.className = 'row g-2 align-items-end mb-2 plot-row';
        row.innerHTML = '<div class="col-md-2"><input type="text" name="plot_block[]" class="form-control" placeholder="e.g., A"></div><div class="col-md-3"><input type="text" name="plot_number[]" class="form-control" required></div><div class="col-md-3"><input type="number" step="0.01" name="plot_size[]" class="form-control" required></div><div class="col-md-3"><input type="text" name="plot_coords[]" class="form-control"></div><div class="col-md-1 d-grid"><button type="button" class="btn btn-outline-danger" data-plot-remove>&times;</button></div>';
        wrap.appendChild(row);
    }
    if (e.target && e.target.hasAttribute('data-plot-remove')) {
        var r = e.target.closest('.plot-row');
        if (r && r.parentNode) r.parentNode.removeChild(r);
    }
});
</script>
<?php require 'includes/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit