<meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="css/style.css"> <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="js/javascript.js"></script> <title></title> </head> <body> <div class="mymenu"> </div> <div class="add-container"> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { ?> <?php $expense = new ExpensesDB(); $errors = $expense->insert($_POST); ?> <?php if (count($errors) == 0) { ?> <?php $success = true; ?> <?php } ?> <?php } ?>
</head> <body> <div class="mymenu"> </div> <?php if (is_numeric($_GET['expense']) && (new ExpensesDB())->isExpenseToUser($_SESSION['id'], $_GET['expense'])) { ?> <?php $expense_data = (new ExpensesDB())->getData($_GET['expense']); ?> <div class="add-container"> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { ?> <?php $expense = new ExpensesDB(); $errors = $expense->update($_GET['expense'], $_POST); ?> <?php if (count($errors) == 0) { ?> <?php $success = true; $expense_data = (new ExpensesDB())->getData($_GET['expense']); ?> <?php } ?> <?php } ?>
<?php session_start(); if (!isset($_SESSION['isLogged'])) { header("Location: login.php"); exit; } require 'earningsDB.php'; $earnings = new EarningsDB(); $salary_earnings = $earnings->getEarningsByType('salary'); $scholarship_earnings = $earnings->getEarningsByType('scholarship'); $inheritance_earnings = $earnings->getEarningsByType('inheritance'); $other_earnings = $earnings->getEarningsByType('other'); require 'expensesDB.php'; $expenses = new ExpensesDB(); $food_expenses = $expenses->getExpensesByType('food'); $fuel_expenses = $expenses->getExpensesByType('fuel'); $education_expenses = $expenses->getExpensesByType('education'); $entertainment_expenses = $expenses->getExpensesByType('entertainment'); $other_expenses = $expenses->getExpensesByType('other'); ?> <html> <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="css/style.css"> <script type="text/javascript" src="js/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="js/javascript.js"></script> </head> <body> <div class="mymenu">