-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathnucall.php
63 lines (52 loc) · 1.82 KB
/
nucall.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
<?php
require_once('nudatabase.php');
if(!array_key_exists('p',$_REQUEST)) {
header("Content-Type: text/html");
header("HTTP/1.0 400 Bad Request");
die('No procedure code is provided.');
}
$getPHPIDQRY = nuRunQuery("
SELECT zzzzsys_php_id FROM zzzzsys_php
WHERE sph_code = ?
", array($_REQUEST['p']));
if(db_num_rows($getPHPIDQRY) != 1){
header("Content-Type: text/html");
header("HTTP/1.0 400 Bad Request");
die('Could not find procedure with code given.');
}
$getPHPIDOBJ = db_fetch_object($getPHPIDQRY);
$PHPID = $getPHPIDOBJ->zzzzsys_php_id;
if($PHPID == ''){
header("Content-Type: text/html");
header("HTTP/1.0 400 Bad Request");
die('Invalid procedure was found.');
}
require_once('nusession.php');
if(!array_key_exists('TEMPORARY_SESSION', $_SESSION)){
$getAccessQRY = nuRunQuery("
SELECT * FROM zzzzsys_session WHERE zzzzsys_session_id = ?
", array($_SESSION['nubuilder_session_data']['SESSION_ID']));
if (db_num_rows($getAccessQRY) != 1) {
header("Content-Type: text/html");
header("HTTP/1.0 400 Bad Request");
die('Could not find session data.');
}
$getAccessOBJ = db_fetch_object($getAccessQRY);
$accessArray = json_decode($getAccessOBJ->sss_access, true);
if ($accessArray['session']['global_access'] != 1) {
$hasAccess = false;
for ($i = 0; $i < count($accessArray['procedures']); $i++) {
if ($accessArray['procedures'][$i][0] == $PHPID)
$hasAccess = true;
}
if (!$hasAccess) {
header("Content-Type: text/html");
header("HTTP/1.0 403 Forbidden");
die('You do not have access to this procedure.');
}
}
}
//require_once('nuevalphpclass.php');
//$procedure = new nuEvalPHPClass($PHPID);
require_once('nucommon.php');
nuEval($PHPID);