Changeset 873 for trunk/Modules/SpeedTest/results.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/SpeedTest/results.php
r786 r873 16 16 17 17 ## Save the results of this speedtest to the database, if enabled 18 if ($config->{'database'}->{'enable'}) {18 if ($config->{'database'}->{'enable'}) { 19 19 $ip_matches = $config->{'database'}->{'ip_matches'}; 20 if ( (! $ip_matches) || ($ip_matches && preg_match("/$ip_matches/",$_SERVER['REMOTE_ADDR'])) ) {20 if ( (! $ip_matches) || ($ip_matches && preg_match("/$ip_matches/",$_SERVER['REMOTE_ADDR'])) ) { 21 21 Debug("Saving to database"); 22 22 $dbh = mysql_connect( … … 57 57 58 58 <?php 59 if (file_exists("header.html")) {59 if (file_exists("header.html")) { 60 60 ## Include "header.html" for a custom header, if the file exists 61 61 include("header.html"); … … 75 75 print "<h2>Download Speed: $clean_down</h2>\n"; 76 76 ## Find the biggest value 77 foreach ($config->{'comparisons-download'} as $key=>$value) {78 if ($value > $download_biggest) {77 foreach ($config->{'comparisons-download'} as $key=>$value) { 78 if ($value > $download_biggest) { 79 79 $download_biggest = $value; 80 80 } … … 82 82 ## Print a pretty table with a graph of the results 83 83 print "<center><table>\n"; 84 foreach ($config->{'comparisons-download'} as $key=>$value) {84 foreach ($config->{'comparisons-download'} as $key=>$value) { 85 85 $this_bar_width = $bar_width / $download_biggest * $value; 86 86 print "<tr><td>$key</td><td>".CleanSpeed($value)."</td><td width=\"400\">\n"; … … 97 97 98 98 ## Don't display the upload stuff if we didn't get a speed to compare with 99 if (isset($_GET['upspeed'])) {99 if (isset($_GET['upspeed'])) { 100 100 $clean_up = CleanSpeed($_GET['upspeed']); 101 101 $upload_biggest = $_GET['upspeed']; 102 102 print "<h2>Upload Speed: $clean_up</h2>\n"; 103 foreach ($config->{'comparisons-upload'} as $key=>$value) {104 if ($value > $upload_biggest) {103 foreach ($config->{'comparisons-upload'} as $key=>$value) { 104 if ($value > $upload_biggest) { 105 105 $upload_biggest = $value; 106 106 } 107 107 } 108 108 print "<table>\n"; 109 foreach ($config->{'comparisons-upload'} as $key=>$value) {109 foreach ($config->{'comparisons-upload'} as $key=>$value) { 110 110 $this_bar_width = $bar_width / $upload_biggest * $value; 111 111 print "<tr><td>$key</td><td>".CleanSpeed($value)."</td>\n"; … … 128 128 </div> 129 129 130 <?php if (file_exists("footer.html")) { include("footer.html"); } ?>130 <?php if (file_exists("footer.html")) { include("footer.html"); } ?> 131 131 132 132 </body> … … 136 136 ## Convert the raw speed value to a nicer value 137 137 function CleanSpeed($kbps) { 138 if ($kbps > 1024) {138 if ($kbps > 1024) { 139 139 $cleanspeed = round($kbps / 1024,2) . " Mbps"; 140 140 } else {
Note:
See TracChangeset
for help on using the changeset viewer.