GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python-Packet-Loss-Monitor/packet_loss_monitor.php at main · drobin04/Python-Packet-Loss-Monitor Expand file tree/ Copy pathpacket_loss_monitor.phpMore file actions 40 lines (34 loc) · 1.37 KB / Copy pathpacket_loss_monitor.phpFile metadata and controls40 lines (34 loc) · 1.37 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 <?php // Set the timezone to Cancun date_default_timezone_set('America/Cancun'); $database = new SQLite3('results.s3db'); // Calculate time passed since last ping failure $last_failure_query = $database->query('SELECT MAX(timestamp) FROM packet_loss'); $last_failure_timestamp = $last_failure_query->fetchArray()[0]; $time_passed = time() - strtotime($last_failure_timestamp); // Calculate the count of failures in the past hour $current_time = time(); $one_hour_ago = $current_time - 3600; $past_hour_query = $database->query("SELECT COUNT(*) FROM packet_loss WHERE timestamp >= $one_hour_ago"); $num_failures = $past_hour_query->fetchArray()[0]; // Calculate hours, minutes, and seconds $hours = floor($time_passed / 3600); $minutes = floor(($time_passed % 3600) / 60); $seconds = $time_passed % 60; // Determine the background color based on the time passed $background_color = ($time_passed > 3600) ? '#c5f3c1' : '#ffcccb'; // Display the information with the appropriate background color echo '<html>'; echo '<head><meta http-equiv="refresh" content="4">'; echo '<style>'; echo 'body {'; echo ' background-color: ' . $background_color . ';'; echo '}'; echo '</style>'; echo '</head>'; echo '<body>'; echo "Time passed since last ping failure: $hours hours, $minutes minutes, $seconds seconds<br>"; echo "Number of failures in the past hour: $num_failures"; echo '</body>'; echo '</html>'; ?> |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |