-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorderStat.php
More file actions
37 lines (32 loc) · 1.01 KB
/
orderStat.php
File metadata and controls
37 lines (32 loc) · 1.01 KB
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
<?php
/*
Template Name: orderStat
*/
?>
<?php
header("Content-Type: application/json; charset=UTF-8");
require '/opt/bitnami/php/composer/vendor/t-conf.php';
function provide_info(){
global $wpdb;
global $SQL_STATUS;
//Set up SQL and query database
$sql = $SQL_STATUS.$_REQUEST["ordid"].'"';
$result = $wpdb->get_results($sql, "ARRAY_A");
return json_encode(array('errors' => array('none'), 'status' => ($result == null ? array('empty') : $result)));
}
if (!empty($_REQUEST["ordid"])){
//Check entry
if (strlen($_REQUEST["ordid"])!=15){
echo json_encode(array('errors' => array('Request cannot be completed.'), 'status' => array('null')));
die();
}
elseif (substr($_REQUEST["ordid"], 0,3) != "ord"){
echo json_encode(array('errors' => array('Request cannot be completed.'), 'status' => array('null')));
die();
}
echo provide_info();
}
else{
echo json_encode(array('errors' => array('ID not given'), 'status' => array('null')));
}
?>