-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.php
More file actions
35 lines (29 loc) · 957 Bytes
/
query.php
File metadata and controls
35 lines (29 loc) · 957 Bytes
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
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
// include database and object files
include_once './connection.php';
include_once './file.php';
$database = new Database();
$db = $database->getConnection();
$task = new File($db);
$task->accessID = isset($_GET['accessID']) ? $_GET['accessID'] : die();
$task->readOne();
if($task->accessID!=null){
$task_arr = array(
"accessID" => $task->accessID,
"storageID" => $task->storageID,
"filetype" => $task->filetype
);
http_response_code(200);
echo json_encode($task_arr);
}
else{
http_response_code(404);
echo json_encode(array("message" => "Task does not exist."));
}
?>