Web Interface For Lite Argus Control modules
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.

70 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months 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 __construct( $LL = LOG_LVL_ALL ){
  30. $this->FLT = $LL;
  31. $this->USERID = 1;
  32. }
  33. function SysLog( $CMD, $LVL, $Dataset = '' ){
  34. global $DATABASE;
  35. $CTS = time();
  36. if( $this->USERID < 2 ) return;
  37. if( ( $LVL & $this->FLT ) == $LVL ){
  38. if( $Dataset == '' ){
  39. $QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd` ) VALUES ( {$this->USERID}, {$CTS}, {$CMD} )";
  40. } else {
  41. $DS = $DATABASE->escape( json_encode( $Dataset ) );
  42. $QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd`, `dataset` ) VALUES( {$this->USERID}, {$CTS}, {$CMD}, '{$DS}' )";
  43. };
  44. $DATABASE->Query( $QS );
  45. };
  46. }
  47. function SetUID( $UID ){
  48. $this->USERID = $UID;
  49. }
  50. function ScreenChanges( $OW, $OH, $NW, $NH ){
  51. $Dataset['old']=array( 'width'=>$OW, 'height'=>$OH );
  52. $Dataset['new']=array( 'width'=>$NW, 'height'=>$NH );
  53. $this->SysLog( ACTION_SCREEN_RESIZE, LOG_LVL_INFO, $Dataset );
  54. }
  55. function login(){
  56. $this->SysLog( ACTION_LOGIN, LOG_LVL_INFO );
  57. }
  58. function logout(){
  59. $this->SysLog( ACTION_LOGOUT, LOG_LVL_INFO );
  60. }
  61. function login_failure($Login,$Password,$UserID,$Session){
  62. $Dataset=array();
  63. $this->SysLog( ACTION_FAILED_LOGIN, LOG_LVL_SECURITY );
  64. }
  65. };
  66. ?>