Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. $Data['status'] = 0;
  4. if( $CUser->Data['id'] > 1 ){
  5. $EID = intval( $_POST['RID'] );
  6. $QS = "SELECT * FROM resources WHERE id = {$EID}";
  7. $Result = $DATABASE->Query( $QS, false );
  8. if( count( $Result ) ){
  9. $R = $Result[0];
  10. switch( $R['type'] ){
  11. case 1:{
  12. $UART_ID = intval($R['aux_id']);
  13. $UART_SPEED = intval($_POST['USPD']);
  14. $UART_BIT = intval($_POST['UBIT']);
  15. $UART_STOP = floatval($_POST['USTP']);
  16. switch( strtoupper( substr( $_POST['UPAR'], 1 ) ) ){
  17. case 'E': $UART_PARITY = 'E'; break;
  18. case 'O': $UART_PARITY = 'O'; break;
  19. default:
  20. $UART_PARITY = 'N';
  21. };
  22. $QS="UPDATE `uart_settings` SET `speed`={$UART_SPEED}, `bit`={$UART_BIT}, `parity`='{$UART_PARITY}', `stop_bit`={$UART_STOP} WHERE id ={$UART_ID}";
  23. $DATABASE->Query( $QS );
  24. break;
  25. };
  26. };
  27. $Data['status'] = 1;
  28. } else {
  29. $Data['msg']='Wrong Resource';
  30. };
  31. } else {
  32. $Data['msg']='Access Error!';
  33. };
  34. echo json_encode( $Data );
  35. ?>