Compare commits
39 commits
145a0b279f
...
e1fad4468d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1fad4468d | ||
|
|
02eb28d4e0 | ||
|
|
057d27221a | ||
|
|
d767f80874 | ||
|
|
c425725423 | ||
|
|
77ddc4907f | ||
|
|
717b2a1bce | ||
|
|
e8c5d38b3a | ||
|
|
682a18132d | ||
|
|
e896275724 | ||
|
|
e0a365b612 | ||
|
|
a1c0033e26 | ||
|
|
4f33d65317 | ||
|
|
5f049cf587 | ||
|
|
e9ac918775 | ||
|
|
a9cb693318 | ||
|
|
d838294ddd | ||
|
|
5a30250932 | ||
|
|
8d0b4bef5e | ||
|
|
095bc6dd42 | ||
|
|
1ebc4ed714 | ||
|
|
8c27dfbd77 | ||
|
|
c176d25287 | ||
|
|
e7567e4d67 | ||
|
|
33bbafaf7f | ||
|
|
7edb42ef83 | ||
|
|
901e0aa812 | ||
|
|
5857299d06 | ||
|
|
67ce656365 | ||
|
|
0d436b0516 | ||
|
|
de6268d86f | ||
|
|
d633cf719d | ||
|
|
3b145cf219 | ||
|
|
86c2ff8ff6 | ||
|
|
7e75006d85 | ||
|
|
47f0907e77 | ||
|
|
090c04eedd | ||
|
|
3e15377b57 | ||
|
|
b8eaaedf53 |
3 changed files with 592 additions and 644 deletions
23
handler.php
23
handler.php
|
|
@ -5,44 +5,37 @@ 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($datafile))
|
||||
if (file_exists($path))
|
||||
{
|
||||
echo file_get_contents($datafile);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '[]';
|
||||
echo file_get_contents($path);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'push':
|
||||
$result = file_put_contents($datafile, $_POST['data']);
|
||||
$result = file_put_contents($path, $_POST['data']);
|
||||
if ($result === false)
|
||||
{
|
||||
echo '{"error": "could not save ' . $datafile . '"}';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '{"result": "ok"}';
|
||||
echo 'error: could not save ' . $_POST['name'];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
echo '{"error": "unknown action ' . $action . '"}';
|
||||
echo 'error: unknown action ' . $action;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '{"error": "missing action parameter"}';
|
||||
echo 'error: missing action parameter';
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
$datafile = '../data/data.acs';
|
||||
$datadir = '../data/';
|
||||
$password = '';
|
||||
?>
|
||||
Loading…
Reference in a new issue