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;
$cycle_count = 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 );
if ( $row['Function'] != 'None' ) $cycle_count++;
}
$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 - - Watch
0 && $last_status == 0 );
header("Refresh: ".REFRESH_STATUS."; URL='$PHP_SELF?view=watchstatus&mid=$mid&last_status=$status'" );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
ZM - - Events Archive
= '".date( "Y-m-d", strtotime($start_date) )." 00:00:00'";
$sort_parms .= '&start_date='.urlencode($start_date);
}
if ( $end_date )
{
$sql .= " and E.EndTime <= '".date( "Y-m-d", strtotime($end_date) )." 23:59:59'";
$sort_parms .= '&end_date='.urlencode($end_date);
}
}
elseif ( $period_count && $period_type )
{
if ( $period_type == "week" )
$sql .= " and E.StartTime >= now() - interval ".(7*$period_count)." day";
else
$sql .= " and E.StartTime >= now() - interval $period_count $period_type";
$sort_parms .= '&period_count='.urlencode($period_count).'&period_type='.urlencode($period_type);
}
if ( $filter_attr && $filter_op && $filter_val )
{
$sql .= " and $filter_attr $filter_op $filter_val";
$sort_parms .= '&filter_attr='.urlencode($filter_attr).'&filter_op='.urlencode($filter_op).'&filter_val='.urlencode($filter_val);
}
$sql .= " order by $sort_column $sort_order";
//echo $sql;
$result = mysql_query( $sql );
if ( !$result )
{
die( mysql_error() );
}
$n_rows = mysql_num_rows( $result );
$period_types = array( ''=>'', 'hour'=>'Hour(s)', 'day'=>'Day(s)', 'week'=>'Week(s)', 'month'=>'Month(s)', 'year'=>'Year(s)' );
$filter_attrs = array( ''=>'', 'Length'=>'Length', 'Frames'=>'Frames', 'AlarmFrames'=>'Alarm Frames', 'AvgScore'=>'Avg. Score', 'MaxScore'=>'Max. Score' );
$filter_ops = array( ''=>'', '<'=>'less than', '<='=>'less than or equal to', '='=>'equal to', '>='=>'greater than or equal to', '>'=>'greater than', '!='=>'not equal to' );
//echo $sort_parms;
?>
ZM - - Events Archive
ZM - Image
ZM - Event -
|
Refresh |
Delete |
Unarchive |
Archive |
Stills |
Stream |
|
Video |
|
Close |
|
|
$thumb_image";
else
$command = NETPBM_DIR."/jpegtopnm -dct fast $capt_image | ".NETPBM_DIR."/pnmscalefixed $fraction | ".NETPBM_DIR."/ppmtojpeg --dct=fast > $thumb_image";
#exec( escapeshellcmd( $command ) );
exec( $command );
}
}
?>
|
|
ZM - - Zones
0 )
{
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
if ( !$result )
die( mysql_error() );
$monitor = mysql_fetch_assoc( $result );
}
else
{
$monitor = array();
$monitor[Name] = "New";
}
?>
ZM - Monitor
0 )
{
$result = mysql_query( "select * from Zones where MonitorId = '$mid' and Id = '$zid'" );
if ( !$result )
die( mysql_error() );
$zone = mysql_fetch_assoc( $result );
}
else
{
$zone = array();
$zone[Name] = "New";
$zone[LoX] = 0;
$zone[LoY] = 0;
$zone[HiX] = $monitor[Width]-1;
$zone[HiY] = $monitor[Height]-1;
}
?>
ZM - - Zone
$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 -