Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/.trash/survey_system/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: team_amounts.php

Path: /home2/outerorb/.trash/survey_system/team_amounts.php

Size: 3.05 KB

Permissions: 0666

<?php
// team_amounts.php - Admin-only page to input sale amounts for teams
require_once 'inc/auth.php';
require_once 'inc/header.php';

// Check if user is admin using helper
if (!is_admin()) {
    echo '<div class="alert alert-danger">Access Denied. Admins only.</div>';
    require_once 'inc/footer.php';
    exit;
}


// DB connection
require_once 'config.php';

// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    foreach (["BBSR", "Vishal", "Poonam"] as $team) {
        $amount = isset($_POST[$team]) ? floatval($_POST[$team]) : 0.00;
        $stmt = $pdo->prepare("UPDATE team_amounts SET amount = ?, updated_at = NOW() WHERE team_name = ?");
        $stmt->execute([$amount, $team]);
    }
    echo '<div class="alert alert-success">Amounts updated successfully.</div>';
}

// Fetch current amounts
$amounts = [];
$stmt = $pdo->query("SELECT team_name, amount FROM team_amounts");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
    $amounts[$row['team_name']] = $row['amount'];
}

?>

<div class="container py-5">
    <div class="row justify-content-center">
        <div class="col-lg-7 col-md-10">
            <div class="card shadow-sm" style="background: #eaf4fb; border-radius: 18px;">
                <div class="card-header d-flex align-items-center" style="background: transparent; color: #343a40; border-top-left-radius: 1rem; border-top-right-radius: 1rem; border-bottom: none;">
                    <i class="bi bi-cash-coin me-2 fs-4" style="color: #343a40;"></i>
                    <span style="font-size: 1.25rem; font-weight: 600; color: #343a40;">Input Team Sale Amounts</span>
                </div>
                <div class="card-body p-4" style="border-bottom-left-radius: 1rem; border-bottom-right-radius: 1rem; color: #6c757d; font-size: 0.93rem;">
                    <form method="post">
                        <table class="table table-bordered text-center mb-4" style="max-width:400px; margin:auto;">
                            <thead class="table-info">
                                <tr><th>Team</th><th>Amount</th></tr>
                            </thead>
                            <tbody>
                                <?php foreach (["BBSR", "Vishal", "Poonam"] as $team): ?>
                                <tr>
                                    <td><?= htmlspecialchars($team) ?></td>
                                    <td><input type="number" step="0.01" name="<?= htmlspecialchars($team) ?>" value="<?= isset($amounts[$team]) ? $amounts[$team] : '0.00' ?>" class="form-control" required></td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                        <div class="text-end">
                            <button type="submit" class="btn btn-primary px-4">Save Amounts</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?php require_once 'inc/footer.php'; ?>

← Back to Directory Edit File 🔒 Chmod

WP File Manager