Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET["hash"])) {
- $hash = $_GET["hash"];
- if (file_exists ("data.json"))
- $json = file_get_contents ("data.json");
- else
- $json = "{}";
- $obj = json_decode ($json);
- if ($obj == null)
- $obj = json_decode ("{}");
- if (isset($obj->{$hash}))
- echo $obj->{$hash};
- else
- echo "e30="; // => "{}"
- return;
- }
- if (!isset($_POST["json"]) || !isset($_POST["hash"])) {
- echo "-1";
- return;
- }
- $data = $_POST["json"];
- $hash = $_POST["hash"];
- if (file_exists ("data.json"))
- $json = file_get_contents ("data.json");
- else
- $json = "{}";
- $obj = json_decode ($json);
- if ($obj == null)
- $obj = json_decode ("{}");
- $obj->{$hash} = $data;
- file_put_contents ("data.json", json_encode ($obj));
- echo "0";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement