prepare("SELECT COUNT(*) FROM detections WHERE Date == \"$theDate\""); $result1 = $statement1->execute(); $totalcount = $result1->fetchArray(SQLITE3_ASSOC); if(isset($_GET['blocation']) ) { header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=result_file.csv"); header("Pragma: no-cache"); header("Expires: 0"); $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); //$sunrise = date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]); //$sunset = date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]); $list = array (); //$hrsinday = intval(($sunset-$sunrise)/60/60); $hrsinday = 24; for($i=0;$i<$hrsinday;$i++) { $starttime = strtotime("12 AM") + (3600*$i); $statement1 = $db->prepare("SELECT DISTINCT(Com_Name), COUNT(*) FROM detections WHERE Date == \"$theDate\" AND Time > '".date("H:i", $starttime)."' AND Time < '".date("H:i",$starttime + 3600)."' AND Confidence > 0.75 GROUP By Com_Name ORDER BY COUNT(*) DESC"); if($statement1 == False){ echo "Database is busy"; header("refresh: 0;"); } $result1 = $statement1->execute(); $detections = []; while($detection=$result1->fetchArray(SQLITE3_ASSOC)) { $detections[$detection["Com_Name"]] = $detection["COUNT(*)"]; } foreach($detections as $com_name=>$scount) { array_push($list, array($com_name,'','','1','',$_GET['blocation'],$config["LATITUDE"],$config["LONGITUDE"],date("m/d/Y", strtotime($theDate)), date("H:i", $starttime), $_GET['state'], $_GET['country'], $_GET['protocol'], $_GET['num_observers'], '60', 'Y', $_GET['dist_traveled'],'',$_GET['notes'] ) ); } } $output = fopen("php://output", "w"); foreach ($list as $row) { fputcsv($output, $row); } fclose($output); die(); } ?>
| Total Detections For The Day |
|---|
No Charts for $theDate
"; } echo "No Charts For $theDate
"; }?>