=0 ; $mq--) if (substr($mquota[0],$mq,1) == '/') { $data_dir = substr($mquota[0], 0, $mq); $mq=0; } mysql_free_result($result); } // // check if the delete form has been submited // if (isset($_GET['what'])) { if ($_GET['what'] == "delete") { // get the list of filenames we are going to delete $query = "SELECT filename FROM security WHERE event_time_stamp IN (".$_GET['todelete'].")"; $result = mysql_query($query) or die ($err_sel_file); // loop for each one for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_array($result); $filename = $row['filename']; // delete the file first if (!unlink($filename)) { die($err_del_file.$filename); } // if no problem, delete the record from the database $query = "DELETE FROM security WHERE filename='".$filename."'"; mysql_query($query) or die ($err_del_req); } mysql_free_result($result); } } ?> <?php echo $config_title;?> = '".$date." 00:00:00' ". "AND event_time_stamp <= '".$date." 23:59:59' ". 'ORDER BY hourfield, camera, timefield, file_type'; $result = mysql_query($query) or die ($err_sel_que1.$query); $numofrows = mysql_num_rows($result); // get also a list of all cameras that has events for the selected day // fill the $camera_list with the result $query = 'SELECT distinct camera '. 'FROM security '. "WHERE event_time_stamp >= '".$date." 00:00:00' ". "AND event_time_stamp <= '".$date." 23:59:59' ". 'ORDER BY camera'; $camera_list = mysql_query($query) or die ($err_sel_que2.$query); $cameras = array(); // hier wird festgelegt wie viele Kameras im Zeilenkopf angezeigt werden!! Anpassen! $num_cameras = 0; for (; $num_cameras < mysql_num_rows($camera_list); $num_cameras++) { $row = mysql_fetch_array($camera_list); $cameras[$num_cameras] = $row['camera']; } mysql_free_result($camera_list); ?> "; echo ""; echo "\n"; echo "\n"; echo '
'; echo "$config_title\n"; echo "


\n"; // draw calendar echo calendar($view_date); echo "
\n"; echo "$selection
"; echo "".$all."  |  ".$nothing."
\n"; echo "\n"; echo "

\n"; echo "

".$config_motion."

\n"; echo "

 

\n"; echo "$config_credits
"; echo "$config_mailname\n"; echo "


\n"; echo '
  '; // if there are any events on the present day if ($numofrows != 0) { echo "\n"; // show the column header only if they have any event echo ''; foreach ($cameras as $cam) { $webcam = "http://$server_name:".$webcam_port[($cam-1)]."/"; $wc_width = $webcam_x; $wc_height = $webcam_y; // get original image size $img_size = getimagesize_from_stream($webcam, $cam); $img_width = $img_size[0]; $img_height = $img_size[1]; // print "1-W:($webcam_x/$webcam_y) I:($img_width/$img_height)"; // resize output window based on image size if($img_width > 0 && $img_height > 0) { if($img_width > $webcam_x) { if($img_height > $webcam_y) { $diff_x = $img_width - $webcam_x; $diff_y = $img_height - $webcam_y; if ($diff_x > $diff_y) { $wc_height = intval($webcam_x * $img_height / $img_width); // print "1.1-($wc_width/$wc_height)"; } else { $wc_width = intval($webcam_y * $img_width / $img_height); // print "1.2-($wc_width/$wc_height)"; } } else { $wc_height = intval($webcam_x * $img_height / $img_width); // print "1.6-($wc_width/$wc_height)"; } } elseif ($img_width < $webcam_x) { if($img_height > $webcam_y) { $wc_width = intval($webcam_y * $img_width / $img_height); // print "2.1-($wc_width/$wc_height)"; } else { $diff_x = $webcam_x - $img_width; $diff_y = $webcam_y - $img_height; if ($diff_x > $diff_y) { $wc_width = intval($webcam_y * $img_width / $img_height); // print "2.2-($wc_width/$wc_height)"; } else { $wc_width = $img_width; $wc_height = $img_height; // print "2.3-($wc_width/$wc_height)"; } } } } // print "
"; $title = "$camera_name $cam"; echo ""; } echo "\n"; $image = ''; $timestamp = 0; $hour = -1; $camera_index = 0; $temp_td = ''; $hour_event_count = 0; // // The $result recordset is expected with two record for each event // the first with the jpeg image (image_type = 1) and // the second with the avi file (image_type = 8), both with the same // event timestamp. // for($i = 0; $i < $numofrows; $i++) { $row = mysql_fetch_array($result); //get a row from our result set $ev_ts = $row['time_stamp']; // // file_type: 1 - image // 2 - image snapshot // 4 - image motion // 8 - mpeg // 16 - mpeg motion // 32 - mpeg timelaps // switch ($row['file_type']) { case 1: // jpeg file // if is another image from the same event, ignore it if ($ev_ts == $timestamp) continue 2; $timestamp = $ev_ts; $image = $row['filename']; $file_type='jpg'; $file_type_desc="$file_type_picture_desc"; // jump to next loop to get correspondent movie file continue 2; case 8: // movie file // if isn't the same event, next row if ($ev_ts != $timestamp) continue 2; $file_type='avi'; $file_type_desc="$file_type_movie_desc"; break; case 32: // timelaps file $image = create_movie_thumb($row['filename']); $file_type='mpg'; $file_type_desc="$file_type_timelapse_desc"; break; default: // if other type, ignore and jump to next row $image = getcwd() . '/error.jpg'; continue 2; } // get hour and camera for this event $hourev = $row['hourfield']; $cameraev = $row['camera']; //echo "HE:$hourev CE:$cameraev FT:$file_type IM:$image
\n"; // has the hour changed? if ($hour != $hourev) { // if not first row (hour) if ($hour != -1) { // if $temp_td not empty, flush it if ($temp_td != '') { echo ''; $temp_td = ''; $camera_index++; } // while not the last column of this row ... while ($camera_index < count($cameras)) { echo ""; $camera_index++; } // end this row echo "\n"; echo "\n"; $hour_event_count = 0; } // start a new row echo ''; echo ""; echo ''; $row_count += 2; $camera_index = 0; $hour = $hourev; } // has camera changed? if ($cameraev != $cameras[$camera_index]) { // if $temp_td not empty, flush it if ($temp_td != '') { echo ''; $temp_td = ''; $camera_index++; } // go to the correct camera column while ($camera_index < count($cameras) AND $cameraev != $cameras[$camera_index]) { echo ''; $camera_index++; } } // new event $event_count++; // if not the first event on this camera and hour, put a separation if ($temp_td) $temp_td .= "
"; // format file size empty($row['file_size']) ? $temp_fsize = read_filesize($row['filename'])/1024 : $temp_fsize = $row['file_size']/1024; if ($temp_fsize > 1024) // mega-byte $temp_fsize = number_format($temp_fsize/1024, 2, ',', '.') . $megabytes; else // kilo-byte $temp_fsize = number_format($temp_fsize, 2, ',', '.') . $kilobytes; // add to the $temp_td the html for this event $temp_td .= "". "". "
". "". '' . $file_type_desc . '  '. $row['timefield'] . " (" . $temp_fsize . ")
"; $hour_event_count++; // reset timestamp value because this event is complete $timestamp = 0; } // if $temp_td not empty, flush it if ($temp_td != '') { echo ''; $temp_td = ''; $camera_index++; } // while not the last column of this row ... while ($camera_index < count($cameras)) { echo ""; $camera_index++; } // end this row echo "\n"; echo "\n"; // now let's close the table and be done with it echo "
   '.$see_surveillance.'  $title  \"$see_camera\" 
'.$temp_td.' 
'.substr($hourev+100,1).$hours.'"; echo " "; echo '' . $list_expand . ''; echo "  "; echo " $events"; echo "
 '.$temp_td.' '.$temp_td.' 
\n"; } else echo '


'.$no_events.'

'; // close the main table echo '
'; // free $result variable mysql_free_result($result); // set the number of event on this page and close the form echo "\n"; echo "\n"; // show disc quota if (isset($data_dir)) { $ratio= 1 - (disk_free_space($data_dir)/disk_total_space($data_dir) ) ; echo "
\n"; echo $vol1_quota . $data_dir . $vol2_quota . number_format($ratio*100, 2, ",", " ") . " %\n"; echo "\n"; echo "
\n"; } ?>