diff --git a/web/zm.php b/web/zm.php index ec2012d63..1691555d4 100644 --- a/web/zm.php +++ b/web/zm.php @@ -4,6 +4,10 @@ include_once( 'browser.php' ); import_request_variables( "GPC" ); +//phpinfo( INFO_VARIABLES ); + +$PHP_SELF = $_SERVER['PHP_SELF']; + $DB_SERVER = "localhost"; // Database Server machine $DB_NAME = "zm"; // Database containing the tables $DB_USER = "zmadmin"; // Database login @@ -95,6 +99,60 @@ if ( $action ) system( escapeshellcmd( "rm -rf events/*/".sprintf( "%04d", $delete_eid ) ) ); } } + elseif ( $action == "function" && $mid ) + { + $result = mysql_query( "select * from Monitors where Id = '$mid'" ); + if ( !$result ) + die( mysql_error() ); + $monitor = mysql_fetch_assoc( $result ); + + $old_function = $monitor['Function']; + if ( $new_function != $old_function ) + { + if ( $new_function == "None" ) + { + } + else + { + } + } + } + elseif ( $action == "device" && isset( $did ) ) + { + if ( $zmc_status && !$zmc_action ) + { + # Shutdown Capture daemon + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zmc $did' | grep -v grep" ) ); + if ( $ps_array[3] ) + { + $zmc = $ps_array[3]; + exec( "kill -TERM $zmc" ); + } + } + elseif ( !$zmc_status && $zmc_action ) + { + # Start Capture daemon + $command = "/usr/local/bin/zmc $did &"; + exec( $command ); + } + if ( $zma_status && !$zma_action ) + { + # Shutdown Analysis daemon + $ps_array = preg_split( "/\s+/", exec( "ps -edalf | grep 'zma $did' | grep -v grep" ) ); + if ( $ps_array[3] ) + { + $zma = $ps_array[3]; + exec( "kill -TERM $zma" ); + } + } + elseif ( !$zma_status && $zma_action ) + { + # Start Analysis daemon + $command = "/usr/local/bin/zma $did &"; + exec( $command ); + } + sleep( 3 ); + } } if ( !$view ) @@ -131,7 +189,26 @@ if ( $view == "console" ) $monitors[] = array_merge( $row, $row2 ); } - //echo phpinfo(); + $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; + } ?> @@ -184,6 +261,7 @@ function newWindow(Url,Name,Width,Height) { $zone_count = 0; foreach( $monitors as $monitor ) { + $device = $devices[$monitor[Device]]; $event_count += $monitor[EventCount]; $hour_event_count += $monitor[HourEventCount]; $day_event_count += $monitor[DayEventCount]; @@ -195,8 +273,8 @@ function newWindow(Url,Name,Width,Height) { . -/dev/video () - +">/dev/video () + xx @@ -374,7 +452,7 @@ elseif ( $view == "status" ) elseif ( $status == 2 ) { $status_string = "Alert"; - $class = "ambtext"; + $class = "oratext"; } header("Refresh: ".REFRESH_STATUS."; URL='index.php?view=status&mid=$mid&last_status=$status'" ); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past @@ -882,3 +960,135 @@ elseif( $view == "video" ) //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<?php echo $did ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Device Daemon Status
DaemonActive
Capture class="form">
Analysis class="form">
 
+ + + + + +ZM - Function - <?php echo $monitor[Name] ?> + + + + + + + + + + + + + + + + + + +
Monitor '' Function
+ + +