-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathajax.php
76 lines (50 loc) · 1.32 KB
/
ajax.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
74
75
76
<?php
try {
include('_mysql.php');
include('_settings.php');
include('_functions.php');
$showAjax = FALSE;
$getSite = (isset($_GET['site'])) ?
getinput($_GET['site']) : 'home';
$getAction = (isset($_GET['action'])) ?
getinput($_GET['action']) : '';
global $image_url;
$image_url = $hp_url . '/images/';
$fileLocation = '';
$getAccess = TRUE;
if (preg_match('/admin_/', $getSite)) {
$fileLocation .= 'admin/';
//
// no admin = no information
if (!isanyadmin($userID)) {
$getAccess = FALSE;
}
}
if (!$getAccess) {
throw new \UnexpectedValueException("access_denied");
}
$fileLocation .= $getSite;
$fileSource = __DIR__ . '/cup/ajax/' . $fileLocation . '.php';
if (isset($getSite) && file_exists($fileSource)) {
$showAjax = TRUE;
include($fileSource);
} else {
//
// Globale Variable wird gekilled
// -> neue Initialisierung
$showAjax = FALSE;
}
} catch (Exception $e) {
echo $e->getMessage();
}
if (!isset($showAjax)) {
$showAjax = FALSE;
}
if (!$showAjax) {
$dataArray = array(
'code' => 404,
'status' => FALSE,
'message' => array('Error 404')
);
echo json_encode($dataArray);
}