add
This commit is contained in:
parent
5d4ce5a41c
commit
ae7cbcb4ae
35
index.php
Normal file
35
index.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
$q = $_REQUEST["q"];
|
||||||
|
$key = "API_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("price"=>$pieces[0], "price_change"=>$pieces[1], "change"=>$pieces[2], "last_update"=>$pieces[3], "server_update"=>$pieces[4]);
|
||||||
|
|
||||||
|
echo json_encode($marks, JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$txt = base64_decode($q);
|
||||||
|
|
||||||
|
$pieces = explode("=", $txt);
|
||||||
|
|
||||||
|
if(strcmp($pieces[5], $key) == 0) {
|
||||||
|
$myfile = fopen("cache.txt", "w") or die("Unable to open file!");
|
||||||
|
fwrite($myfile, $txt);
|
||||||
|
fclose($myfile);
|
||||||
|
echo "Done!";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "Key Invalid";
|
||||||
|
fclose($myfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user