summaryrefslogtreecommitdiff
path: root/plugins/session/www/rpc.php
blob: 9e27bc35e90b5506876f77fc403d30d531e9b43c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

define('SESS_ROOT', __DIR__ . '/../');

require_once SESS_ROOT . 'main.php';

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']);
}