-
Notifications
You must be signed in to change notification settings - Fork 0
/
primjer.php
46 lines (37 loc) · 1 KB
/
primjer.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
<?php
require_once('misc.php');
/* require_once('baza.php'); we don't have baza.php */
if (isset($_GET['bundle_id']) && !empty($_GET['bundle_id']) && isset($_GET['language_id']) && !empty($_GET['language_id']))
{
$db = new database();
$db->spojiDB();
$bundle_id = $db->real_escape_string($_GET['bundle_id']);
$language_id = $db->real_escape_string($_GET['language_id']);
$bought = false;
$userID = null;
if (isset($_GET['token'])){
if (VerifyToken($_GET['token']) == true)
{
$userID = ReturnUserId($_GET['token']);
}
else{
Error(401,'Unauthorized, token mismatch');
exit();
}
}
if ($userID!=null){
$status = 200;
$timestamp = GetTime();
$result[0]["bought"] = $bought;
$result[0]["categories"] = $resCategories;
$result[0]["audio_number"] = $resAudioCount;
header('Content-type: application/json');
$json = json_encode(array("status"=>$status, "timestamp"=>$timestamp, "data"=>$result));
echo $json;
}
}
else
{
Error(400,"Missing or wrong parametars");
}
?>