-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
35 lines (29 loc) · 898 Bytes
/
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
<?php
/**
* @file index.php
* @author Mahmoud Ahmed Tawfik (@mahmoudahmedd)
* @date 03/05/2019
* @version 1.0
*/
// include database and core files
include_once '/config/database.php';
include_once '/config/core.php';
$data["api_version"] = $CONF['api_version'];
if(isset($_GET['a']) && isset($_GET['b']) && isset($pages[$_GET['a']]) && isset($actions[$_GET['b']]))
{
$page_name = $pages[$_GET['a']];
$action = $actions[$_GET['b']];
// include object file
include_once("/classes/{$page_name}.php");
include_once("/sources/{$page_name}/{$action}.php");
}
else
{
$data["status"] = "fail";
$data["message"] = "Unsupported get request. Please read the API documentation.";
// set response code - 404 Not found
http_response_code(404);
// tell the user no products found
echo json_encode($data);
}
?>