r2828 - fixContext(): check return value of spotEntity() (ticket:51)
[racktables] / ajax.php
CommitLineData
11048491
DY
1<?php
2
da111736 3require 'inc/init.php';
1dcdcc47
DY
4$_REQUEST['page'] = 'perms';
5$_REQUEST['tab'] = 'edit';
11048491
DY
6fixContext();
7
8// We have a chance to handle an error before starting HTTP header.
9if (!permitted())
10{
11 $errlog = array
12 (
13 'v' => 2,
14 'm' => array (0 => array ('c' => 157)) // operation not permitted
15 );
1dcdcc47 16 echo "NAK\nPermission denied";
11048491
DY
17 exit();
18}
19
1dcdcc47 20switch ($_REQUEST['ac'])
11048491
DY
21{
22 case 'verifyCode':
1dcdcc47 23 $code = str_replace ('\r', '', str_replace ('\n', "\n", $_REQUEST['code']));
11048491
DY
24 $result = getRackCode($code);
25 if ($result['result'] == 'ACK')
26 echo 'ACK';
27 else
28 echo "NAK\n".$result['load'];
29 break;
30}
31
32
33?>