-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadList.php
39 lines (30 loc) · 918 Bytes
/
loadList.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
<?php
/* Imports */
require_once __DIR__ . '/config/apiReturn.php';
require_once __DIR__ . '/config/constants.php';
require_once __DIR__ . '/config/authenticate.php';
require_once __DIR__ . '/repository/database.php';
require_once __DIR__ . '/repository/lists.php';
/* Set required header and session start */
requiredHeaderAndSessionStart();
/* Connect to database */
$conn = getConnection();
if (!(isValidPostVar('listType'))) {
exit(MISSING_PARAMETERS);
}
$result = null;
if (checkSessionInfo() && validateUser($conn)) {
$userType = trim($_SESSION['userType']);
$listType = $_POST['listType'] ?? '';
if (isLibrarian()) {
$result = getLibrarianListResults($listType, $conn);
} else {
if (isHeadmaster()) {
$result = getHeadmasterListResults($listType, $conn);
}
}
echo createQueryJSON($result);
} else {
redirectToLogin();
}
$conn = null;