corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
<?php // ۞ // text { encoding:utf-8 ; bom:no ; linebreaks:unix ; tabs:4sp ; }
/*
Simple JSON database decoder
;o)
(c) copyright corz.org 2011->today
*/
// built-in header (for distro tools, etc)
echo '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<title>Simple JSON Database File Decoder in php</title>
</head>';
$tmp_file = '/tmp/json.file';
$name = $decoded_string = '';
if ($_FILES) {
$name = $_FILES['json_file']['name'];
move_uploaded_file($_FILES['json_file']['tmp_name'], $tmp_file);
$j_string = file_get_contents($tmp_file);
$decoded_string = json_decode($j_string);
unlink($tmp_file);
}
echo '<body>
<h1>Simple PHP JSON Decoder: ',$name,'</h1>
<form enctype="multipart/form-data" action="',$_SERVER['REQUEST_URI'],'" method="POST">
<div class="form"><label>Input JSON code:<br />
<textarea name="output" rows="32" cols="120" style="width:100%;">',print_r($decoded_string),'</textarea><br />
</label>
<br />
<label>Upload a JSON file: <input id="upload" class="upload-slot" type="file" name="json_file" /></label>
<input type="submit" id="do-it" value="decode!" title="docode it!" />
</div>
</form>
</body>
</html>';
?>