-
Notifications
You must be signed in to change notification settings - Fork 0
/
bestelling.php
73 lines (52 loc) · 1.87 KB
/
bestelling.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
session_start();
use src\ProjectBrood\business\BestellingBusiness;
use Doctrine\Common\ClassLoader;
require('head.php'); // sets user authorization status
require_once'Doctrine/Common/ClassLoader.php';
$classLoader = new ClassLoader("src");
$classLoader->register();
if ((empty($_SESSION['bestelling'])) || (!isset($_SESSION['bestelling'])))
{
header('Location: index.php');
}
if (!empty($_SESSION['successMessage']))
{
unset($_SESSION['bestelling']);
}
$_SESSION['successMessage'] = (!isset($_SESSION['successMessage']) ? '' : $_SESSION['successMessage']);
if (isset($_SESSION['user']))
{
if ($_SESSION['user']['authorized'] == 1)
{
$bestellingStatus = true;
if (isset($_SESSION['bestelling']))
{
/**
* Als klant betaalt zijn bestelling
*/
if (isset($_POST['betalenKnoop']))
{
$obj = new BestellingBusiness();
$obj->voegNieuwBestelling($_SESSION['totaalBestellingPrijs'], $_SESSION['user']['userId'], $_SESSION['bestelling']);
$_SESSION['successMessage'] = "Bedankt voor uw bestelling";
$_SESSION['totaalBestellingPrijs'] = 0;
header("Refresh: 0");
}
}
}
else
{
$bestellingStatus = false;
}
}
require_once("lib/Twig/Autoloader.php");
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("src/ProjectBrood/presentation");
$twig = new Twig_Environment($loader);
$view = $twig->render("bestelling.twig", array("bestellingStatus" => $bestellingStatus, "authorized" => $_SESSION['user']['authorized'], "totaalBestellingPrijs" => $_SESSION['totaalBestellingPrijs'], "successMessage" => $_SESSION['successMessage']));
print($view);
if (!isset($_SESSION['bestelling']) && !empty($_SESSION['successMessage']))
{
$_SESSION['successMessage'] = '';
}