diff --git a/scripts/overview.php b/scripts/overview.php index 8328913..35cb628 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -10,65 +10,66 @@ if($db == False) { if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isset($_GET['previous_detection_identifier'])) { - $statement4 = $db->prepare('SELECT Com_Name, Sci_Name, Date, Time, Confidence, File_Name FROM detections ORDER BY Date DESC, Time DESC LIMIT 1'); + $statement4 = $db->prepare('SELECT Com_Name, Sci_Name, Date, Time, Confidence, File_Name FROM detections ORDER BY Date DESC, Time DESC LIMIT 50'); if($statement4 == False) { echo "Database is busy"; header("refresh: 0;"); } $result4 = $statement4->execute(); - $mostrecent = $result4->fetchArray(SQLITE3_ASSOC); - $comname = preg_replace('/ /', '_', $mostrecent['Com_Name']); - $sciname = preg_replace('/ /', '_', $mostrecent['Sci_Name']); - $comname = preg_replace('/\'/', '', $comname); - $filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name']; + // hopefully one of the 5 most recent detections has an image that is valid, we'll use that one as the most recent detection until the newer ones get their images created + while($mostrecent = $result4->fetchArray(SQLITE3_ASSOC)) { + $comname = preg_replace('/ /', '_', $mostrecent['Com_Name']); + $sciname = preg_replace('/ /', '_', $mostrecent['Sci_Name']); + $comname = preg_replace('/\'/', '', $comname); + $filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name']; - - if($_GET['previous_detection_identifier'] != $filename || $_GET['previous_detection_identifier'] == "undefined") { - // check to make sure the image actually exists, sometimes it takes a minute to be created - if (isset($_SERVER['HTTPS']) && - ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || - isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && - $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { - $protocol = 'https://'; - } - else { - $protocol = 'http://'; - } - $headers = @get_headers($protocol.$_SERVER['HTTP_HOST'].$filename.".png"); - if(strpos($headers[0],'200')) { - ?> - + +

Most Recent Detection:

+ + + + +
+
+ +
+ +
Confidence:
+
- -

Most Recent Detection:

- - - - -
-
- -
- -
Confidence:
-