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

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

?>
<?php
$user_id = $_SESSION['gen256']['id'];

$sqlBar = "SELECT categorytype, SUM(amount) as total 
           FROM expenses 
           WHERE user_id = '$user_id' 
             AND MONTH(date) = MONTH(CURDATE()) 
             AND YEAR(date) = YEAR(CURDATE()) 
           GROUP BY categorytype";
$resultBar = mysqli_query($conn, $sqlBar);

$labelsBar = [];
$valuesBar = [];
while ($row = mysqli_fetch_assoc($resultBar)) {
    $labelsBar[] = $row['categorytype'];
    $valuesBar[] = $row['total'];
}
?>
<div style="width:100%; height:250px;">
    Expense Summary for <?php echo date("F Y"); ?>
  <canvas id="expenseBarChart"></canvas>
</div>

<script>
const ctxBar = document.getElementById('expenseBarChart').getContext('2d');
new Chart(ctxBar, {
    type: 'bar',
    data: {
        labels: <?php echo json_encode($labelsBar); ?>,
        datasets: [{
            label: 'Expenses',
            data: <?php echo json_encode($valuesBar); ?>,
            backgroundColor: 'rgba(54, 162, 235, 0.6)'
        }]
    },
    options: {
        responsive: true,
        maintainAspectRatio: false
    }
});
</script>

LittleDemon - FACEBOOK
[ KELUAR ]