b7620ec4a211ef7518aa2f49c4a5c3d377f80fae
[racktables] / ajax.php
1 <?php
2 ob_start();
3 try {
4
5 require 'inc/init.php';
6 $pageno = 'perms';
7 $tabno = 'edit';
8 fixContext();
9
10 if (!permitted())
11 {
12 echo "NAK\nPermission denied";
13 exit();
14 }
15
16 switch ($_REQUEST['ac'])
17 {
18 case 'verifyCode':
19 $code = str_replace ('\r', '', str_replace ('\n', "\n", $_REQUEST['code']));
20 $result = getRackCode($code);
21 if ($result['result'] == 'ACK')
22 echo 'ACK';
23 else
24 echo "NAK\n".$result['load'];
25 break;
26 }
27 ob_end_flush();
28 }
29 catch (Exception $e)
30 {
31 ob_end_clean();
32 printException($e);
33 }
34
35 ?>