2020-06-18 12:24:13 +02:00
|
|
|
<?php
|
|
|
|
include'database.php';
|
|
|
|
|
2020-06-22 23:00:43 +02:00
|
|
|
function reportCreation()
|
|
|
|
{
|
|
|
|
$data = $_POST;
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
createReport($pdo, $data);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: report.php');
|
2020-06-18 12:24:13 +02:00
|
|
|
}
|
|
|
|
|
2020-06-22 23:00:43 +02:00
|
|
|
function reportModification()
|
|
|
|
{
|
|
|
|
$data = $_POST;
|
|
|
|
$id = $_POST["id"];
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
editReport($pdo, $data, $id);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: report.php');
|
2020-06-18 12:24:13 +02:00
|
|
|
}
|
|
|
|
|
2020-06-22 23:00:43 +02:00
|
|
|
function reportDeletion()
|
|
|
|
{
|
|
|
|
$id = $_GET["delete"];
|
|
|
|
$pdo = connectDatabase();
|
|
|
|
deleteReport($pdo, $id);
|
|
|
|
closeDatabase($pdo);
|
|
|
|
header('location: report.php');
|
2020-06-18 12:24:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_POST["create"])) {
|
|
|
|
reportCreation();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST["edit"])) {
|
|
|
|
reportModification();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_GET["delete"])) {
|
|
|
|
reportDeletion();
|
|
|
|
}
|