/
compare.php
executable file
·107 lines (94 loc) · 3.82 KB
/
compare.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
include 'common.inc';
require_once('page_data.inc');
// get the list of tests
$tests = $_REQUEST['t'];
$runs = $_REQUEST['r'];
$labels = $_REQUEST['l'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Web page performance test comparison</title>
<meta http-equiv="charset" content="iso-8859-1">
<meta name="keywords" content="Performance, Optimization, Pagetest, Page Design, CDN, Content Distribution Network">
<meta name="description" content="Speed up the performance of your web pages with an automated analysis">
<meta name="author" content="Patrick Meenan">
<style type="text/css">
<?php
include 'pagestyle.css';
?>
</style>
<?php include('analytics.inc'); ?>
</head>
<body>
<div class="page">
<?php
$tab = null;
include 'header.inc';
?>
<div class="content">
<form name="compare" method="get" action="/compare.php">
<h1>This is still experimental and under heavy development. Feel free to poke around but don't be surprised if things don't look right or work.</h1>
<table>
<h1>Comparison Settings:</h1>
<tr><th>Test ID</th><th>Run</th><th>Label</th><th>Url</th></tr>
<?php
foreach( $tests as $index => $test )
{
echo "<tr><td><a target=\"_blank\" href=\"/result/$test/\">$test</a><input type=\"hidden\" name=\"t[$index]\" value=\"$test\" /></td>\n";
// populate the runs
$run = $runs[$index];
if(!$run )
$run = 1;
$runCount = 10;
echo "<td><select id=\"run$index\" name=\"r[$index]\">\n";
for( $i = 1; $i <= $runCount; $i++ )
{
$selected = '';
if( $run == $i )
$selected = ' selected';
echo "<option value=\"$i\" $selected>$i</option>\n";
}
echo '</select></td>';
// populate the label
echo "<td><input id=\"label$index\" type=\"text\" name=\"l[$index]\" style=\"width:30em\" value=\"{$labels[$index]}\" /></td>";
// populate the url
echo "<td><a rel=\"nofollow\" href=\"$url\">$url</a></td>\n";
echo "</tr>\n";
}
?>
</table>
<input id="CompareBtn" type="submit" value="Update Comparison">
</form>
<h1>Load Times:</h1>
<?php
echo "<img id=\"chartLoad\" alt=\"Load Times Chart\" src=\"/compareChart.php?type=times" . CompParams() . "\">";
?>
</div>
</div>
</body>
</html>
<?php
/**
* Spit out the standard paramaters that we need to pass to everything
*
*/
function CompParams()
{
$out = '';
global $tests;
global $runs;
global $labels;
foreach( $tests as $index => $t )
$out .= "&t[$index]=$t";
foreach( $runs as $index => $r )
$out .= "&r[$index]=$r";
foreach( $labels as $index => $label )
{
$l = urlencode($label);
$out .= "&l[$index]=$l";
}
return $out;
}
?>