-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathup.php
More file actions
50 lines (36 loc) · 867 Bytes
/
up.php
File metadata and controls
50 lines (36 loc) · 867 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
45
46
47
48
49
50
<html>
<head>
<title>Upload page</title>
</head>
<body>
<p>Here's the php</p>
<?php
print "_POST:<br/>";
var_dump($_POST);
$json_get = $_GET["json"];
$json_post = $_POST["json"];
$json_str = $json_get;
if ($json_post)
{
$json_str = $json_post;
}
$json = json_decode($json_str,true);
print "json_str:<br/>";
print $json_str;
print "<br/><br/>decoded json object:<br/>";
var_dump($json);
$dangerous = array(".", "\\", "!", "\/");
$json["id"] = str_replace($dangerous, "", $json["id"]);
if (($json != NULL) and ($json["id"] != NULL)) {
file_put_contents($json["id"] . ".json", $json_str);
}
print "<br/><br/>last error:<br/>";
print $json_errors[json_last_error()];
print "<br/><br/>decoded id:<br/>";
print $json["id"];
print "<br/><br/>decoded stamp:<br/>";
print $json["stamp"];
print "<br/><br/>decoded light:<br/>";
print $json["light"];
?>
</body>