summaryrefslogtreecommitdiff
path: root/plugins/session/www/rpc.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/session/www/rpc.php')
-rw-r--r--plugins/session/www/rpc.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/session/www/rpc.php b/plugins/session/www/rpc.php
index fca85a0..9e27bc3 100644
--- a/plugins/session/www/rpc.php
+++ b/plugins/session/www/rpc.php
@@ -4,13 +4,18 @@ define('SESS_ROOT', __DIR__ . '/../');
require_once SESS_ROOT . 'main.php';
-$entry = (!empty($_POST['salt']) && strlen($_POST['salt']) >= 16) ?
- create_key($_POST['salt']) : FALSE;
-
-if ($entry) {
- header('Content-type: text/plain; charset=UTF-8');
- print json_encode($entry);
+if (!empty($_POST['salt']) && strlen($_POST['salt']) >= 16) {
+ $entry = create_key($_POST['salt']);
+ if ($entry) {
+ header('Content-type: text/plain; charset=UTF-8');
+ print json_encode($entry);
+ }
+ else {
+ header('HTTP/1.1 403 Forbidden');
+ print json_encode(['error' => 'no-session']);
+ }
}
else {
header('HTTP/1.1 403 Forbidden');
+ print json_encode(['error' => 'no-request']);
}