-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
49 lines (41 loc) · 1.24 KB
/
index.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
<?php
$pageTitle = 'Home';
$links = array('home');
//addons to assist with injection
include_once $_SERVER['DOCUMENT_ROOT'].'/includes/helpers.inc.php';
//functions for access and logging in
require_once $_SERVER['DOCUMENT_ROOT'].'/includes/access.inc.php';
if(!userLoggedIn()){
header('Location: /Authentication/Login/');
exit();
}
require $_SERVER['DOCUMENT_ROOT'].'/includes/db.inc.php';
//Retrieve approvals counts
$counts=array();
$sql= array(
'apply' => "SELECT COUNT(*) FROM `events` WHERE `status` = 'apply'"
,'confirm' => "SELECT COUNT(*) FROM `events` WHERE `status` = 'confirm' AND `placeholder` = 0"
);
$pdo->beginTransaction();
foreach ($sql as $key => $value) {
try {
$$key = $pdo->prepare($value);
$$key->execute();
} catch (PDOException $e) {
$error = ' Error retrieving approval count for '.$key;
include $_SERVER['DOCUMENT_ROOT'].'/includes/error.html.php';
}
}
$pdo->commit();
foreach ($sql as $key => $value) {
$counts[$key] = $$key->fetch()[0];
}
//Top section of master page
include $_SERVER['DOCUMENT_ROOT'].'/includes/head.html.php';
if(isset($_GET['Permission'])) {
include 'permission.html';
} else {
include 'home.html.php';
}
//Bottom section of master page
include $_SERVER['DOCUMENT_ROOT'].'/includes/foot.html.php';