Compare commits

..

No commits in common. "e1fad4468d76a6ed536965f48e6d2ab724e6c9eb" and "145a0b279fb550aac4b9e3d5a49f09040b83318a" have entirely different histories.

3 changed files with 643 additions and 591 deletions

View File

@ -5,37 +5,44 @@ require 'settings.php';
// check authent
if ($password && (!isset($_POST['password']) || $_POST['password'] != $password))
{
echo 'error: authent';
echo '{"error": "authent"}';
}
else if (isset($_POST['action']))
{
$action = $_POST['action'];
$path = $datadir . $_POST['name'];
switch ($action)
{
case 'fetch':
if (file_exists($path))
if (file_exists($datafile))
{
echo file_get_contents($path);
echo file_get_contents($datafile);
}
else
{
echo '[]';
}
break;
case 'push':
$result = file_put_contents($path, $_POST['data']);
$result = file_put_contents($datafile, $_POST['data']);
if ($result === false)
{
echo 'error: could not save ' . $_POST['name'];
echo '{"error": "could not save ' . $datafile . '"}';
}
else
{
echo '{"result": "ok"}';
}
break;
default:
echo 'error: unknown action ' . $action;
echo '{"error": "unknown action ' . $action . '"}';
break;
}
}
else
{
echo 'error: missing action parameter';
echo '{"error": "missing action parameter"}';
}
?>

1209
main.js

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
<?php
$datadir = '../data/';
$datafile = '../data/data.acs';
$password = '';
?>