LittleDemon WebShell


Linux premium274.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Path : /home/whagcoha/ledger.mwagalwaservices.com/
File Upload :
Command :
Current File : /home/whagcoha/ledger.mwagalwaservices.com/viewincome.php

<?php
if ((!isset($_SESSION['gen256']))  ) {
  echo "<script>
        window.open('login.php','_self');
    </script>";  
}

?>
<?php
require 'dbconfig/db.php';
$userids=$_SESSION['gen256']['id'];

// DELETE
if (isset($_GET['delete'])) {
    $id = $_GET['delete'];
    $stmt = $conn->prepare("DELETE FROM income WHERE id = ?");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $stmt->close();
    echo '<script>
        window.location.href = "index.php?p=viewincome";
      </script>';
    exit;
}

// FETCH RECORDS
$query = "SELECT * FROM income WHERE (user_id='$userids') ORDER BY date DESC";
$result = $conn->query($query);

$records = [];
if ($result && $result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        $records[] = $row;
    }
}
?>

<div class="container mt-5">
    <h2 class="mb-4">Income Records</h2>

    <a href="index.php?p=addincome" class="btn btn-primary mb-3">➕ Add New Income</a>

    <?php if (count($records) > 0): ?>
        <div class="table-responsive">
    <table class="table table-bordered table-hover">
        <thead class="table-dark">
            <tr>
              
               <!--  <th>User ID</th> -->
                <th>Source</th>
                <th>Amount</th>
                <th>Date</th>
                <th>Notes</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($records as $row): ?>
                <tr>
                   
                    

                    <td><?= htmlspecialchars($row['source']) ?></td>
                    <td><?= number_format($row['amount'], 2) ?></td>
                    <td><?= $row['date'] ?></td>
                    <td><?= htmlspecialchars($row['notes']) ?></td>
                    <td>
                        <a href="index.php?p=editincome&&id=<?= $row['id'] ?>" class="btn btn-sm btn-warning">✏️ Edit</a>
                        <a href="index.php?p=viewincome&&delete=<?= $row['id'] ?>" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this record?');">🗑️ Delete</a>
                    </td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
    <?php else: ?>
        <p class="text-muted">No income records found.</p>
    <?php endif; ?>
</div>

LittleDemon - FACEBOOK
[ KELUAR ]