1024) $tfic=(int)($tfic / 1024). $megabytes; else $tfic=(int)($tfic). $bytes; $majsize = mysql_query("update security set file_size='$tfic' where filename ='$fic';") or die($err_upd_size); //mysql_free_result($majsize); return $tfic; } // connect to database $db = mysql_connect($sql_host, $sql_user, $sql_pass) or die($err_sel_data); mysql_select_db($sql_db) or die($err_sel_size); // Récupération du chemin des fichiers de données if (!isset($datadisque)) { $query = "SELECT filename FROM security order by time_stamp desc limit 0,1"; $result = mysql_query($query) or die ($err_req_quota); $mquota = mysql_fetch_row($result); // Recherche du path des fichiers de données $maxquot=strlen($mquota[0]); for ($mq=$maxquot ; $mq >=0 ; $mq--) if (substr($mquota[0],$mq,1) == '/') { $datadisque=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); } } ?> MotionBrowser 1.01 = '.$date.'000000 '. 'AND event_time_stamp <= '.$date.'235959 '. '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.'000000 '. 'AND event_time_stamp <= '.$date.'235959 '. 'ORDER BY camera'; $camera_list = mysql_query($query) or die ($err_sel_que2.$query); $cameras = array(); $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 "".$all."  |  ".$nothing."
\n"; echo "\n"; echo "

\n"; echo "

Configurer Motion

\n"; echo "

 

\n"; echo "Carlos Ladeira (c) 2006
"; echo "caladeira@gmail.com\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_addr:".$webcam_port[($cam-1)]."/"; $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']; 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']; // 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; break; default: // if other type, ignore and jump to next row continue 2; } // get hour and camera for this event $hourev = $row['hourfield']; $cameraev = $row['camera']; // 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 .= "
"; // add to the $temp_td the html for this event $temp_td .= "". "". "
". "". "   ".$row['timefield']." (".(empty($row['file_size']) ? afftaille($row['filename']) : $row['file_size']) .")
"; $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 "
  $title  \"$see_camera\" 
'.$temp_td.' 
'.substr($hourev+100,1).$hours.'"; echo " "; echo ""; 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"; // Affichage du quota disque if (isset($datadisque)) { $ratio= 1 - (disk_free_space($datadisque)/disk_total_space($datadisque) ) ; echo "
\n"; echo $vol1_quota.$datadisque.$vol2_quota.number_format($ratio*100,2,","," ")." %\n"; echo "\n"; echo "
\n"; } ?>