Ejemplo n.º 1
0
<?php

# php -S localhost:8999
require './jsave_cf.php';
// simulate ajax request?
$json = asStr($DATA, 'json');
$path = asStr($DATA, 'path');
if (isset($DATA['json']) && $json !== '0' && !empty($path)) {
    jsave_emit(jsave_get($path));
    exit;
}
?>
<!DOCTYPE html>
<html>
  <head>
    <title>JSAVE</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="./index.css" rel="stylesheet">
    <script src="/lib/jquery/1.8.2/jquery.js"></script>
  </head>
  <body class="loading">

    <form id="Form" action=".">
      <div>JSAVE <a id="Link" href="">#RELOAD#</a></div>
      <input type="hidden" name="json" value="0">
      loaded <input id="Load" type="text" name="load" value="<?php 
echo $path;
?>
">
        json <textarea id="Data" name="data"></textarea>
Ejemplo n.º 2
0
setDebug("{$DATA['dbg']}");
$path = asStr($DATA, 'path');
$data = asStr($DATA, 'data');
$pure = stripslashes($data);
$json = jsave_decode($pure);
$link = jsave_put($path, $json ? $pure : '');
$read = jsave_get($path);
$DATA['json'] = $json;
$DATA['link'] = $link;
if ($debug < 3 && !empty($path)) {
    if ($debug == 2) {
        flashBack();
    }
    // emit JSON
    $DATA['read'] = $read;
    jsave_emit(json_encode($DATA));
    exit;
} else {
    // continue LOGGING
    error_log("Refresh in 3 @ {$SERV['REMOTE_ADDR']}");
    $DATA['read'] = json_decode($read);
}
### ### ### ### ### ### ###
?>
<!DOCTYPE HTML>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>jsave_io.php</title>
  </head>
  <body>