-
Notifications
You must be signed in to change notification settings - Fork 39
/
fileinfo.json.php
34 lines (28 loc) · 968 Bytes
/
fileinfo.json.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
<?php
require_once './configuration.php';
require_once './functions.php';
session_write_close();
header('Content-Type: application/json');
$object = new stdClass();
$object->error = true;
$object->filename = "";
$object->size = 0;
$object->msg = "";
if (empty($_REQUEST['secret']) || $_REQUEST['secret'] !== $global['secret']) {
$object->msg = 'Incorrect Secret';
error_log($object->msg);
die(json_encode($object));
}
if (empty($_GET['filename'])) {
$object->msg = 'FILESIZE GET file not found';
error_log($object->msg);
die(json_encode($object));
}
$object->filename = $_GET['filename'];
$object->resolution = getResolutionFromFilename($_GET['filename']);
$object->size = getUsageFromFilename($_GET['filename']);
$object->modified = getModifiedTimeFromFilename($_GET['filename']);
$object->modifiedDate = date('Y/m/d H:i:s', $object->modified);
$object->date = date('Y/m/d H:i:s');
$object->error = false;
die(json_encode($object));