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.
 
 
 
 

71 lines
2.1 KiB

<?php
define( "ACTION_LOGOUT", 0 );
define( "ACTION_LOGIN", 1 );
define( "ACTION_FAILED_LOGIN", 2 );
define( "ACTION_SCREEN_RESIZE", 145 );
//define( "ARGUS_LFS_SENSOR", 2 );
//define( "ARGUS_PLS_200_SENSOR", 3 );
//define( "ARGUS_PLS_360_SENSOR", 4 );
//define( "ARGUS_3D_SENSOR", 5 );
//define( "ARGUS_NET_PLS_200", 6 );
//define( "ARGUS_ANALOG_STATIC_CAMERA", 10 );
//define( "ARGUS_ANALOG_PTZ_CAMERA", 11 );
//define( "ARGUS_IP_STATIC_CAMERA", 12 );
//define( "ARGUS_IP_PTZ_CAMERA", 13 );
//define( "ARGUS_IP_UART_GATEWAY", 20 );
//define( "ARGUS_JAMER", 40 );
//define( "ARGUS_IP_VIDEO_SERVER", 50 );
//define( "ARGUS_DRONE_CONTROL", 60 );
define( "LOG_LVL_NONE", 0 );
define( "LOG_LVL_INFO", 1 );
define( "LOG_LVL_CONFIG", 2 );
define( "LOG_LVL_MNGMT", 4 );
define( "LOG_LVL_SECURITY", 8 );
define( "LOG_LVL_ERROR", 128 );
define( "LOG_LVL_ALL", 255 );
class Logio{
var $USERID;
var $FLT;
function __construct( $LL = LOG_LVL_ALL ){
$this->FLT = $LL;
$this->USERID = 1;
}
function SysLog( $CMD, $LVL, $Dataset = '' ){
global $DATABASE;
$CTS = time();
if( $this->USERID < 2 ) return;
if( ( $LVL & $this->FLT ) == $LVL ){
if( $Dataset == '' ){
$QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd` ) VALUES ( {$this->USERID}, {$CTS}, {$CMD} )";
} else {
$DS = $DATABASE->escape( json_encode( $Dataset ) );
$QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd`, `dataset` ) VALUES( {$this->USERID}, {$CTS}, {$CMD}, '{$DS}' )";
};
$DATABASE->Query( $QS );
};
}
function SetUID( $UID ){
$this->USERID = $UID;
}
function ScreenChanges( $OW, $OH, $NW, $NH ){
$Dataset['old']=array( 'width'=>$OW, 'height'=>$OH );
$Dataset['new']=array( 'width'=>$NW, 'height'=>$NH );
$this->SysLog( ACTION_SCREEN_RESIZE, LOG_LVL_INFO, $Dataset );
}
function login(){
$this->SysLog( ACTION_LOGIN, LOG_LVL_INFO );
}
function logout(){
$this->SysLog( ACTION_LOGOUT, LOG_LVL_INFO );
}
function login_failure($Login,$Password,$UserID,$Session){
$Dataset=array();
$this->SysLog( ACTION_FAILED_LOGIN, LOG_LVL_SECURITY );
}
};
?>