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
|
// check authent
|
||||||
if ($password && (!isset($_POST['password']) || $_POST['password'] != $password))
|
if ($password && (!isset($_POST['password']) || $_POST['password'] != $password))
|
||||||
{
|
{
|
||||||
echo '{"error": "authent"}';
|
echo 'error: authent';
|
||||||
}
|
}
|
||||||
else if (isset($_POST['action']))
|
else if (isset($_POST['action']))
|
||||||
{
|
{
|
||||||
$action = $_POST['action'];
|
$action = $_POST['action'];
|
||||||
|
$path = $datadir . $_POST['name'];
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
case 'fetch':
|
case 'fetch':
|
||||||
if (file_exists($datafile))
|
if (file_exists($path))
|
||||||
{
|
{
|
||||||
echo file_get_contents($datafile);
|
echo file_get_contents($path);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '[]';
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'push':
|
case 'push':
|
||||||
$result = file_put_contents($datafile, $_POST['data']);
|
$result = file_put_contents($path, $_POST['data']);
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
{
|
{
|
||||||
echo '{"error": "could not save ' . $datafile . '"}';
|
echo 'error: could not save ' . $_POST['name'];
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo '{"result": "ok"}';
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
echo '{"error": "unknown action ' . $action . '"}';
|
echo 'error: unknown action ' . $action;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '{"error": "missing action parameter"}';
|
echo 'error: missing action parameter';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
$datafile = '../data/data.acs';
|
$datadir = '../data/';
|
||||||
$password = '';
|
$password = '';
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in a new issue