NOW() - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>NOW() - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount, count(Z.MonitorId) as ZoneCount from Monitors as M inner join Zones as Z on Z.MonitorId = M.Id left join Events as E on E.MonitorId = M.Id group by E.MonitorId,Z.MonitorId order by Id" );
$sql = "select M.*, count(E.Id) as EventCount, count(if(E.Archived,1,NULL)) as ArchEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>NOW() - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>NOW() - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount from Monitors as M left join Events as E on E.MonitorId = M.Id group by E.MonitorId order by Id";
$result = mysql_query( $sql );
if ( !$result )
echo mysql_error();
$monitors = array();
$max_width = 0;
$max_height = 0;
while( $row = mysql_fetch_assoc( $result ) )
{
if ( $max_width < $row[Width] ) $max_width = $row[Width];
if ( $max_height < $row[Height] ) $max_height = $row[Height];
$sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'";
$result2 = mysql_query( $sql );
if ( !$result2 )
echo mysql_error();
$row2 = mysql_fetch_assoc( $result2 );
$monitors[] = array_merge( $row, $row2 );
}
$sql = "select distinct Device from Monitors order by Device";
$result = mysql_query( $sql );
if ( !$result )
echo mysql_error();
$devices = array();
while( $row = mysql_fetch_assoc( $result ) )
{
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $row[Device]' | grep -v grep" ) );
if ( $ps_array[3] )
{
$row['zmc'] = 1;
}
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $row[Device]' | grep -v grep" ) );
if ( $ps_array[3] )
{
$row['zma'] = 1;
}
$devices[] = $row;
}
?>
ZM - Console
Zone Monitor Console
ZM - Cycle Watch
ZM - - Monitor
ZM - - Events Archive
ZM - Images - - Images
$thumb_image";
else
$command = "jpegtopnm -dct fast $image | pnmscalefixed $fraction | ppmtojpeg --dct=fast > $thumb_image";
#exec( escapeshellcmd( $command ) );
exec( $command );
}
}
?>
|
|
ZM - Image
ZM - Event -
|
Refresh |
Delete |
Archive |
Stills |
Stream |
|
Video |
Close |
|
|
$thumb_image";
else
$command = "jpegtopnm -dct fast $image | pnmscalefixed $fraction | ppmtojpeg --dct=fast > $thumb_image";
#exec( escapeshellcmd( $command ) );
exec( $command );
}
}
?>
|
|
ZM - - Zones
$event_dir/mpeg.log" ) );
}
//chdir( $event_dir );
//header("Content-type: video/mpeg");
//header("Content-Disposition: inline; filename=$video_name");
header("Location: $video_file" );
}
elseif ( $view == "device" )
{
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) );
if ( $ps_array[3] )
{
$zmc = 1;
}
$ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) );
if ( $ps_array[3] )
{
$zma = 1;
}
?>
ZM - Device - /dev/video
ZM - Function -
/dev/null >&- <&- >/dev/null &';
exec( $command );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
while ( !$pid )
{
sleep( 1 );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
$pid = $ps_array[3];
}
}
function stopDaemon( $daemon, $did )
{
$ps_command = "ps -edalf | grep '$daemon $did' | grep -v grep";
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
if ( $ps_array[3] )
{
$pid = $ps_array[3];
exec( "kill -TERM $pid" );
}
else
{
return;
}
while( $pid )
{
sleep( 1 );
$ps_array = preg_split( "/\s+/", exec( $ps_command ) );
$pid = $ps_array[3];
}
}
function getEnumValues( $table, $column )
{
$enum_values = array();
$result = mysql_query( "DESCRIBE $table $column" );
if ( $result )
{
$row = mysql_fetch_assoc($result);
preg_match_all( "/'([^']+)'/", $row[Type], $enum_matches );
$enum_values = $enum_matches[1];
}
else
{
echo mysql_error();
}
return $enum_values;
}
?>