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