summaryrefslogtreecommitdiff
path: root/plugins/session/www/rpc.php
blob: 5efdf82187b5ceee490b30b9e4985e8d85852c39 (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: application/json');
    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']);
}