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.

69 lines
2.0 KiB

5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. define( "ACTION_LOGOUT", 0 );
  3. define( "ACTION_LOGIN", 1 );
  4. define( "ACTION_FAILED_LOGIN", 2 );
  5. define( "ACTION_SCREEN_RESIZE", 145 );
  6. //define( "ARGUS_LFS_SENSOR", 2 );
  7. //define( "ARGUS_PLS_200_SENSOR", 3 );
  8. //define( "ARGUS_PLS_360_SENSOR", 4 );
  9. //define( "ARGUS_3D_SENSOR", 5 );
  10. //define( "ARGUS_NET_PLS_200", 6 );
  11. //define( "ARGUS_ANALOG_STATIC_CAMERA", 10 );
  12. //define( "ARGUS_ANALOG_PTZ_CAMERA", 11 );
  13. //define( "ARGUS_IP_STATIC_CAMERA", 12 );
  14. //define( "ARGUS_IP_PTZ_CAMERA", 13 );
  15. //define( "ARGUS_IP_UART_GATEWAY", 20 );
  16. //define( "ARGUS_JAMER", 40 );
  17. //define( "ARGUS_IP_VIDEO_SERVER", 50 );
  18. //define( "ARGUS_DRONE_CONTROL", 60 );
  19. define( "LOG_LVL_NONE", 0 );
  20. define( "LOG_LVL_INFO", 1 );
  21. define( "LOG_LVL_CONFIG", 2 );
  22. define( "LOG_LVL_MNGMT", 4 );
  23. define( "LOG_LVL_SECURITY", 8 );
  24. define( "LOG_LVL_ERROR", 128 );
  25. define( "LOG_LVL_ALL", 255 );
  26. class Logio{
  27. var $USERID;
  28. var $FLT;
  29. function Logio( $LL = LOG_LVL_ALL ){
  30. $this->FLT = $LL;
  31. $this->USERID = 1;
  32. }
  33. function SysLog( $CMD, $LVL, $Dataset = '' ){
  34. global $DATABASE;
  35. if( $this->USERID < 2 ) return;
  36. if( ( $LVL & $this->FLT ) == $LVL ){
  37. if( $Dataset == '' ){
  38. $QS = "INSERT INTO `access_log` SET `user_id`={$this->USERID}, `ts`=NOW(), `cmd`={$CMD}";
  39. } else {
  40. $DS = $DATABASE->escape( json_encode( $Dataset ) );
  41. $QS = "INSERT INTO `access_log` SET `user_id`={$this->USERID}, `ts`=NOW(), `cmd`={$CMD}, `dataset`='{$DS}'";
  42. };
  43. $DATABASE->Query( $QS );
  44. };
  45. }
  46. function SetUID( $UID ){
  47. $this->USERID = $UID;
  48. }
  49. function ScreenChanges( $OW, $OH, $NW, $NH ){
  50. $Dataset['old']=array( 'width'=>$OW, 'height'=>$OH );
  51. $Dataset['new']=array( 'width'=>$NW, 'height'=>$NH );
  52. $this->SysLog( ACTION_SCREEN_RESIZE, LOG_LVL_INFO, $Dataset );
  53. }
  54. function login(){
  55. $this->SysLog( ACTION_LOGIN, LOG_LVL_INFO );
  56. }
  57. function logout(){
  58. $this->SysLog( ACTION_LOGOUT, LOG_LVL_INFO );
  59. }
  60. function login_failure($Login,$Password,$UserID,$Session){
  61. $Dataset=array();
  62. $this->SysLog( ACTION_FAILED_LOGIN, LOG_LVL_SECURITY );
  63. }
  64. };
  65. ?>