-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
44 lines (37 loc) · 920 Bytes
/
index.php
File metadata and controls
44 lines (37 loc) · 920 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
36
37
38
39
40
41
42
43
44
<?php
header('Content-Type: application/json; charset=utf-8');
$q = $_REQUEST["q"];
$key = "KEY";
if ($q == "")
{
$myfile = fopen("cache.txt", "r") or die("Unable to open file!");
$teks = fread($myfile, filesize("cache.txt"));
fclose($myfile);
$pieces = explode(",", $teks);
$marks = array(
"terkonfirmasi" => $pieces[0],
"perawatan" => $pieces[1],
"sembuh" => $pieces[2],
"meninggal" => $pieces[3],
"last_update" => $pieces[4],
"server_update" => $pieces[5]
);
echo json_encode($marks, JSON_PRETTY_PRINT);
}
else
{
$txt = base64_decode($q);
$pieces = explode(",", $txt);
if (strcmp($pieces[6], $key) == 0)
{
$myfile = fopen("cache.txt", "w") or die("Unable to open file!");
fwrite($myfile, $txt);
fclose($myfile);
echo "Done!";
}
else
{
die("Key Invalid");
}
}
?>