/
verification.php
62 lines (44 loc) · 1.3 KB
/
verification.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
<?php
ob_start();
session_start();
require('head.php');
use src\ProjectBrood\business\UsersBusiness;
use Doctrine\Common\ClassLoader;
use src\ProjectBrood\exceptions\OngeldigeAanvraagException;
if (isset($_GET['hash']) && !empty($_GET['hash']))
{
try
{
require_once'Doctrine/Common/ClassLoader.php';
$classLoader = new ClassLoader("src");
$classLoader->register();
$userEmailHash = $_GET['hash'];
/**
* Create user object
*/
$obj = new UsersBusiness();
/**
* Check by email hash if user exists
*/
$userVerification = $obj->verifyUser($userEmailHash);
if(empty($userVerification)) throw new OngeldigeAanvraagException();
}
catch(OngeldigeAanvraagException $e)
{
$userVerification[0] = "error";
}
/**
* Load twig template for verification page
*/
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("verificatie.twig", array("verifiedUser" => $userVerification[0], "authorized" => $_SESSION['user']['authorized']));
print($view);
}
else
{
header('Location: index.php');
}
ob_flush();