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/addincome2.php

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

?>

<?php
require 'dbconfig/db.php';


$success = $error = '';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user_id = $_SESSION['gen256']['id'];
    $source = $_POST['source'];
    $amount = $_POST['amount'];
    $date = $_POST['date'];
    $notes = $_POST['notes'];

    $stmt = $conn->prepare("INSERT INTO income (user_id, source, amount, date, notes) VALUES (?, ?, ?, ?, ?)");
    if ($stmt) {
        $stmt->bind_param("isdss", $user_id, $source, $amount, $date, $notes);
        if ($stmt->execute()) {
            $success = "Income record added successfully!";
        } else {
            $error = "Execute failed: " . $stmt->error;
        }
        $stmt->close();
    } else {
        $error = "Prepare failed: " . $conn->error;
    }
}
?>

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

    <?php if (!empty($success)): ?>
        <div class="alert alert-success"><?= htmlspecialchars($success) ?></div>
    <?php elseif (!empty($error)): ?>
        <div class="alert alert-danger"><?= htmlspecialchars($error) ?></div>
    <?php endif; ?>

    <form method="POST" action="">
        <div class="mb-3">
            <label class="form-label">Source of Income</label>
            <input type="text" name="source" class="form-control" required>
        </div>

        <div class="mb-3">
            <label class="form-label">Amount</label>
            <input type="number" name="amount" step="0.01" class="form-control" required>
        </div>

        <div class="mb-3">
            <label class="form-label">Date Received</label>
            <input type="date" name="date" class="form-control" required>
        </div>

        <div class="mb-3">
            <label class="form-label">Notes</label>
            <textarea name="notes" class="form-control" rows="3"></textarea>
        </div>

        <button type="submit" class="btn btn-primary">Save Income</button>
    </form>

    <li class="nav-item mt-4">
        <a class="nav-link" href="index.php?p=viewincome">
            <i class="fas fa-fw fa-folder"></i>
            <span>View Income</span>
        </a>
    </li>
</div>

LittleDemon - FACEBOOK
[ KELUAR ]