-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdata.php
More file actions
58 lines (52 loc) · 1.94 KB
/
Copy pathdata.php
File metadata and controls
58 lines (52 loc) · 1.94 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html><html><style>body,p{font-family:corbel,arial;background:#dfd;margin-left:2%}th,tr,td{background:#fff;padding-left:1em; border:1px solid #930;border-collapse:collapse;width:30em}
th{background:#2e2}td:nth-child(2n){color:#000}
tr:nth-child(2n-1){background:#ddf}*(not:style){display:table}
table,tr,td{display:inline;margin-left:1em}*:hover{background:#dfd}
</style>
<?php
//File stuff, followed by latency conversion array
$str = file_get_contents(date('j')."l.txt");
$data="<center><h1>Server Speed Monitor</h1></center><br><body><p>How fast is the server? <a href='colour.php'>Check your speed</a> and come back.
The speed of the site is displayed below. <a href='data.php?sort=1'>Sort by time</a></p>";
echo'Date: ' . date("m-d @ H\h\\r\s\ \A\C\S\T");
$x=0;
foreach(explode('<br>', $str) as $r){
$rr[$x]=$r;
$x++;
}
if($_GET['sort']!=""){
sort($rr,SORT_NUMERIC);}
//Prepares and displays data
foreach($rr as $row){
$row = explode(',', $row);
if((time() - $row[2]) < 86400){
$l = $row[0];
if($l < 0){$l += 100000;}
#Comments on the latency, and sets the colour
if($l < 90000){$q = "Pain!";}
if($l < 4500){$q = "Tor";}
if($l < 900){$q = "Slooow";}
if($l < 800){$q = "Slow";}
if($l < 700){$q = "Ok-ish";}
if($l < 600){$q = "Ok";}
if($l < 500){$q = "Good";}
if($l < 400){$q = "Nice";}
if($l < 300){$q = "Great";}
if($l < 200){$q = "Fast!";}
if($l < 100){$qual = "WOW"; }
$col = 'hsl('.round((1000-$l)/5).',90%,70%)';
//Allow switching between modes of data
if($_GET['r']==""){$y=date("H:i:s",$row[2]);}
else{$y=$row[$_GET['r']%6];}
//Design data display
if($row[0]!=""){
$data.= "<table style='width:20%'><tr><td style='background:".$col."'>" . $y. "</td><td background:".$col.">". $row[0]. "ms ($q) #".(crc32($row[1])%100)."</td></tr></table>";
$i++;
//Averages latency
$late += $l;
}}}
//RELEASE!
if($str!=""){$r = round($late/$i);}else{$r = '?';}
echo "<title>$i</title><br>$r ms average speed, $i result(s)<br>".$data;
echo '</blockquote>';
?></body></html>