-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.php
606 lines (504 loc) · 19.1 KB
/
results.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
<?php
require_once("utils.php");
require_once("private/db.php");
//createTables();
if ( array_key_exists('ib', $_GET) && array_key_exists('id', $_GET) &&
array_key_exists('sb', $_GET) && array_key_exists('sd', $_GET) &&
array_key_exists('tb', $_GET) && array_key_exists('tc', $_GET) &&
array_key_exists('url', $_GET) ) {
$ib = $_GET['ib'];
$id = $_GET['id']; // this is the # of images sprited MINUS the number of sprites created
$sb = $_GET['sb'];
$sd = $_GET['sd'];
$tb = $_GET['tb'];
$tc = $_GET['tc'];
// The # of bg images when we're done is the number of original images minus the number of images sprited (already offset by the number of sprite images created).
$ia = $ib - $id;
// The total size of bg images when we're done is the original size plus the change in size. (Technically, this includes bg images that weren't considered for spriting.)
$sa = $sb + $sd;
$url = substr($_GET['url'], 0, 253);
$now = time();
$testnameid = 0;
if ( array_key_exists('testname', $_COOKIE) && strlen($_COOKIE['testname']) > 0 ) {
$testname = substr($_COOKIE['testname'], 0, 253);
$command = "insert into spritemetestnames set createdate=$now, testname='$testname';";
doSimpleCommand($command);
$query = "select testnameid from spritemetestnames where testname='$testname';";
$testnameid = doSimpleQuery($query);
}
// strip off all querystrings for privacy
if ( ereg("(http.*)\?", $url, $regs) ) {
$url = $regs[1];
}
$command = "insert into spritemesavings set createdate=$now, url='$url', ib=$ib, ia=$ia, id=$id, sb=$sb, sa=$sa, sd=$sd, tb=$tb, tc=$tc" .
( $testnameid ? ", testnameid=$testnameid" : "" ) . ";";
doSimpleCommand($command);
header("HTTP/1.0 204 No Content");
header("Expires: Sun, 11 Dec 2016 00:08:03 GMT");
return;
}
else if ( array_key_exists('id', $_GET) && array_key_exists('sd', $_GET) && array_key_exists('url', $_GET) ) {
$now = time();
$id = $_GET['id'];
$sd = $_GET['sd'];
$url = substr($_GET['url'], 0, 253);
$testnameid = 0;
if ( array_key_exists('testname', $_COOKIE) && strlen($_COOKIE['testname']) > 0 ) {
$testname = substr($_COOKIE['testname'], 0, 253);
$command = "insert into spritemetestnames set createdate=$now, testname='$testname';";
doSimpleCommand($command);
$query = "select testnameid from spritemetestnames where testname='$testname';";
$testnameid = doSimpleQuery($query);
}
// strip off all querystrings for privacy
if ( ereg("(http.*)\?", $url, $regs) ) {
$url = $regs[1];
}
$command = "insert into spritemesavings set createdate=$now, url='$url', id=$id, sd=$sd" .
( $testnameid ? ", testnameid=$testnameid" : "" ) . ";";
doSimpleCommand($command);
header("HTTP/1.0 204 No Content");
header("Expires: Sun, 11 Dec 2016 00:08:03 GMT");
return;
}
else if ( array_key_exists('format', $_GET) ) {
$format = $_GET['format'];
if ( "html" == $format ) {
$sHtml = getSavings();
echo <<<OUTPUT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>SpriteMe Savings</title>
</head>
<body>
$sHtml
</body>
</html>
OUTPUT;
}
return;
}
else if ( false === strpos($_SERVER["REQUEST_URI"], "results.php") ) {
return;
}
function getSummarySavings() {
$query = "select AVG(id) as iavg, AVG(sd) as savg from spritemesavings;";
$result = doQuery($query);
$row = mysql_fetch_assoc($result);
$iavg = $row['iavg'];
$savg = $row['savg'];
mysql_free_result($result);
$query = "select count(*) from spritemesavings;";
$count = doSimpleQuery($query);
return "SpriteMe users have shared <span style='font-weight: bold; color: #000;'>$count results</span> with an average savings of <span style='font-weight: bold; color: #000;'>" . myround($iavg) . " HTTP requests</span> and <span style='font-weight: bold; color: #000;'>" . myround($savg/1000) . "K of data</span>.";
}
function getSavings($bCss = true, $limit = 10, $bTop = false) {
global $gaUrls;
$query = "select createdate, url, ib, ia, id, sb, sd, tb, tc from spritemesavings order by createdate desc limit $limit;";
if ( $bTop ) {
$hugeRegx .= "";
for ( $i = 0; $i < count($gaUrls); $i++ ) {
$url = $gaUrls[$i];
$url = str_replace("http://", "", $url);
$query = "select savingsid from spritemesavings, spritemetestnames where spritemesavings.testnameid = spritemetestnames.testnameid and testname = 'top100us' and url regexp '$url' order by spritemesavings.createdate desc limit 1;";
$savingsid = doSimpleQuery($query);
if ( $savingsid ) {
$hugeRegex .= ( $hugeRegex ? " or " : "" ) . "savingsid = $savingsid";
}
else {
error_log("no data: $url");
}
}
$query = "select url, ib, ia, id, sb, sd, tb, tc from spritemesavings where ($hugeRegex) order by (500*id + sd) desc;";
}
$result = doQuery($query);
$sHtml = "";
if ( $bCss ) {
$sHtml .= <<<OUTPUT
<style>
.savingstable TH { padding: 2px 8px; color: #333; backgmyround: #CCC; font-weight: bold; }
.savingstable TD { padding: 2px 0; color: #333; backgmyround: #FFF; }
TD.sdate { padding: 2px 8px; }
TD.surl { padding: 2px 16px; }
TD.sreqs { text-align: right; padding: 0; font-weight: bold; }
TD.snum { text-align: right; }
TD.ssize { text-align: right; }
TD.ssizedelta { text-align: right; padding-left: 8px; }
TD.stext { font-size: 0.8em; padding-left: 4px; padding-right: 4px; color: #888; }
TD.sborder { border-left: 0px solid #CCC; padding-left: 16px; }
TD.avg { backgmyround: #FFF; font-weight: bold; text-decoration: none; border-bottom: 1px solid; }
A.asize { text-decoration: none; }
.selrow { background: #F0F0F0; }
</style>
OUTPUT;
}
$sHeadersRow =
"<tr> <th> </th> " .
//"<th> </th> " .
"<th>existing<br>sprites</th> <th>images<br>sprited</th> <th>sprites<br>created</th> <th colspan=2>change<br>in size</th> </tr>\n";
$sHtml .= "<table border=0 class=savingstable cellspacing=0 cellpadding=0>\n" . $sHeadersRow;
$avgcntr = $rowcntr = 0;
$totalImages = $totalDelta = $totalExistingSprites = $totalSpritesCreated = 0;
$sRows = "";
while ($row = mysql_fetch_assoc($result)) {
$url = $row['url'];
$ib = $row['ib'];
$id = $row['id'];
$sb = $row['sb'];
$sd = $row['sd'];
$tb = $row['tb'];
$tc = $row['tc'];
$iText = "";
$avgcntr++;
$rowcntr++;
$sRow = "<tr" . ( 0 == ($rowcntr % 2) ? "" : " class=selrow" ) . ">" .
"<td class=sdate>" . date("D h:i a", $row['createdate']) . "</td>" .
//"<td class=surl><a class=ahover href='$url' target='_blank'>" . shortenUrl($url) . "</a></td>" .
"<td class=snum style='text-align: center;'>$tb</td>";
if ( 1 >= $ib || 0 == $tc ) {
// No background images exist in the page - exclude this site from overall stats.
$id = "-";
if ( 1 >= $ib ) {
$avgcntr--; // doesn't count!
}
$sRow .=
"<td class='stext' colspan=8 style='text-align: left;'>" .
( 1 == $ib ? "only 1 background image" : ( 0 == $ib ? "no background images" : "$ib images, but no sprites found" ) ) . "</td>" .
"</tr>\n";
}
else {
$totalExistingSprites += $row['tb'];
$totalSpritesCreated += $row['tc'];
$totalImages += $row['id'] + $row['tc'];
$totalDelta += ($row['sd']);
$sSize = "";
if ( 0 <= $sd ) {
// Good - size got smaller!
$sSize = "<td class=snum style='padding-right: 10px;'><a href='javascript:function(){}' class=asize style='color: #060;' title='" .
myround(100*$sd/($sd+$sb)) . "% (" . myround($sd/1000) . "K/" . myround(($sb+$sd)/1000) . "K)'>" . ( 0 == myround($sd/1000) ? "" : "-" ) . myround($sd/1000) . "K</a></td>";
}
else {
// Bad - size got bigger
$sSize = "<td class=snum style='padding-right: 10px;'><a href='javascript:function(){}' class=asize style='color: #C00;' title='" .
myround(-100*$sd/($sd+$sb)) . "% (" . myround((-1*$sd)/1000) . "K/" . myround(($sb-$sd)/1000) . "K)'>+" . myround((-1*$sd)/1000) . "K</a></td>";
}
$sRow .=
"<td class=snum style='padding-right: 20px;'>" . ($id+$tc) . "</td>" .
"<td class=snum style='text-align: center; padding-right: 0;'>$tc</td>" .
$sSize .
"</tr>\n";
}
$sRows .= $sRow;
}
mysql_free_result($result);
if ( $avgcntr ) {
$totalDelta = -1*$totalDelta; // a positive delta is really a reduction (minus) in size
$sHtml .= "" .
"<tr>" .
"<td class=avg></td>" .
//"<td class=avg style='text-align: right; padding-right: 20px;'>AVERAGE</td>" .
"<td class='snum avg' style='text-align: center; padding-right: 0;'>" . myround($totalExistingSprites/$avgcntr) . "</td>" .
"<td class='snum avg' style='padding-right: 20px;'>" . myround($totalImages/$avgcntr) . "</td>" .
"<td class='snum avg' style='text-align: center; padding-right: 0;'>" . myround($totalSpritesCreated/$avgcntr) . "</td>" .
"<td class='snum avg' style='padding-right: 10px; color: " .
( $totalDelta > 0 ? "#C00" : "#0A0" ) . ";'>" . ( $totalDelta > 0 ? "+" : "" ) . myround($totalDelta/($avgcntr*1000)) . "K</td>" .
"</tr>\n" .
$sRows .
$sHeadersRow .
"";
}
$sHtml .= "</table>\n";
return $sHtml;
}
function getSavingsDiff($bCss, $start1, $end1, $start2, $end2) {
$query1 = "select createdate, url, id, sd from spritemesavings where savingsid >= $start1 and savingsid <= $end1 group by url order by createdate desc;";
$result1 = doQuery($query1);
$sHtml = "";
if ( $bCss ) {
$sHtml .= <<<OUTPUT
<style>
.savingstable TH { padding: 0; color: #333; backgmyround: #CCC; font-weight: bold; }
.savingstable TD { padding: 2px 8px 2px 8px; color: #333; backgmyround: #FFF; }
TD.surl { padding-right: 0; }
TD.sreqs { text-align: right; padding-right: 16px; padding-left: 0; }
TD.ssize { text-align: right; padding-right: 8px; }
TH.ssize { padding-left: 8px; padding-right: 8px; }
TD.avg { backgmyround: #FFF; font-weight: bold; text-decoration: none; border-bottom: 1px solid; }
</style>
OUTPUT;
}
$sHtml .= "<table class=savingstable border=0 cellspacing=0 cellpadding=0>\n" .
"<tr> <th></th> <th></th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> </tr>\n";
$cntr = 0;
$totalImages1 = 0;
$totalDelta1 = 0;
$totalImages2 = 0;
$totalDelta2 = 0;
$sRows = "";
while ($row1 = mysql_fetch_assoc($result1)) {
$url = $row1['url'];
$id1 = $row1['id'];
$sd1 = $row1['sd'];
$query2 = "select createdate, url, id, sd from spritemesavings where savingsid >= $start2 and savingsid <= $end2 and url = '$url' limit 1;";
$result2 = doQuery($query2);
$url2 = "";
$id2 = $sd2 = 0;
while ($row2 = mysql_fetch_assoc($result2)) {
$url2 = $row2['url']; // use this as a flag
$id2 = $row2['id'];
$sd2 = $row2['sd'];
break;
}
mysql_free_result($result2);
if ( $url2 ) {
$sRows .= "<tr>" .
"<td class=sdate>" . date("H:i", $row1['createdate']) . "</td>" .
"<td class=surl><a class=ahover href='" . $row1['url'] . "' target='_blank'>" . shortenUrl($url) . "</a></td>" .
"<td class=sreqs>$id1</td>" .
"<td class=ssize>" . myround($sd1/1000) . " K</td>" .
"<td class=sreqs style='" . ( $id2 > $id1 ? "color: #0A0" : ( $id2 < $id1 ? "color: #C00" : "" ) ) . "'>$id2</td>" .
"<td class=ssize style='" . ( $sd2 > $sd1 ? "color: #0A0" : ( $sd2 < $sd1 ? "color: #C00" : "" ) ) . "'>" . myround($sd2/1000) . " K</td>" .
"</tr>\n";
$cntr++;
$totalImages1 += $id1;
$totalDelta1 += $sd1;
$totalImages2 += $id2;
$totalDelta2 += $sd2;
}
}
mysql_free_result($result1);
if ( $cntr ) {
$sHtml .= "<tr>" .
"<td class=avg></td>" .
"<td class=avg style='text-align: right;'>AVERAGE SAVINGS</td>" .
"<td class='sreqs avg'>" . intval( ($totalImages1/$cntr) + 0.5 ) . "</td>" .
"<td class='ssize avg'>" . intval( ($totalDelta1/($cntr*1000)) + 0.5 ) . " K</td>" .
"<td class='sreqs avg'>" . intval( ($totalImages2/$cntr) + 0.5 ) . "</td>" .
"<td class='ssize avg'>" . intval( ($totalDelta2/($cntr*1000)) + 0.5 ) . " K</td>" .
"</tr>\n" .
$sRows .
"<tr> <th></th> <th></th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> </tr>\n";
}
$sHtml .= "</table>\n";
return $sHtml;
}
function getSavingsDiffTestnames($bCss, $testname1, $testname2) {
$query = "select testnameid from spritemetestnames where testname = '$testname1';";
$testnameid1 = doSimpleQuery($query);
$query = "select testnameid from spritemetestnames where testname = '$testname2';";
$testnameid2 = doSimpleQuery($query);
if ( !testnameid1 || !$testnameid2 ) {
return;
}
$query1 = "select createdate, url, id, sd from spritemesavings where testnameid=$testnameid1 group by url;";
$result1 = doQuery($query1);
$sHtml = "";
if ( $bCss ) {
$sHtml .= <<<OUTPUT
<style>
.savingstable TH { padding: 0; color: #333; backgmyround: #CCC; font-weight: bold; }
.savingstable TD { padding: 2px 8px 2px 8px; color: #333; backgmyround: #FFF; }
TD.surl { padding-right: 0; }
TD.sreqs { text-align: right; padding-right: 16px; padding-left: 0; }
TD.ssize { text-align: right; padding-right: 8px; }
TH.ssize { padding-left: 8px; padding-right: 8px; }
TD.avg { backgmyround: #FFF; font-weight: bold; text-decoration: none; border-bottom: 1px solid; }
</style>
OUTPUT;
}
$sHtml .= "<table class=savingstable border=0 cellspacing=0 cellpadding=0>\n" .
"<tr> <th></th> <th></th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> </tr>\n";
$cntr = 0;
$totalImages1 = 0;
$totalDelta1 = 0;
$totalImages2 = 0;
$totalDelta2 = 0;
$sRows = "";
while ($row1 = mysql_fetch_assoc($result1)) {
$url = $row1['url'];
$id1 = $row1['id'];
$sd1 = $row1['sd'];
$query2 = "select createdate, url, id, sd from spritemesavings where testnameid=$testnameid2 and url='$url' limit 1;";
$result2 = doQuery($query2);
$url2 = "";
$id2 = $sd2 = 0;
while ($row2 = mysql_fetch_assoc($result2)) {
$url2 = $row2['url']; // use this as a flag
$id2 = $row2['id'];
$sd2 = $row2['sd'];
break;
}
mysql_free_result($result2);
if ( $url2 ) {
$sRows .= "<tr>" .
"<td class=sdate>" . date("H:i", $row1['createdate']) . "</td>" .
"<td class=surl><a class=ahover href='" . $row1['url'] . "' target='_blank'>" . shortenUrl($url) . "</a></td>" .
"<td class=sreqs>$id1</td>" .
"<td class=ssize>" . myround($sd1/1000) . " K</td>" .
"<td class=sreqs style='" . ( $id2 > $id1 ? "color: #0A0" : ( $id2 < $id1 ? "color: #C00" : "" ) ) . "'>$id2</td>" .
"<td class=ssize style='" . ( $sd2 > $sd1 ? "color: #0A0" : ( $sd2 < $sd1 ? "color: #C00" : "" ) ) . "'>" . myround($sd2/1000) . " K</td>" .
"</tr>\n";
$cntr++;
$totalImages1 += $id1;
$totalDelta1 += $sd1;
$totalImages2 += $id2;
$totalDelta2 += $sd2;
}
}
mysql_free_result($result1);
if ( $cntr ) {
$sHtml .= "<tr>" .
"<td class=avg></td>" .
"<td class=avg style='text-align: right;'>AVERAGE SAVINGS</td>" .
"<td class='sreqs avg'>" . intval( ($totalImages1/$cntr) + 0.5 ) . "</td>" .
"<td class='ssize avg'>" . intval( ($totalDelta1/($cntr*1000)) + 0.5 ) . " K</td>" .
"<td class='sreqs avg'>" . intval( ($totalImages2/$cntr) + 0.5 ) . "</td>" .
"<td class='ssize avg'>" . intval( ($totalDelta2/($cntr*1000)) + 0.5 ) . " K</td>" .
"</tr>\n" .
$sRows .
"<tr> <th></th> <th></th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> <th class=sreqs>requests<br>eliminated</th> <th class=ssize>bytes<br>saved</th> </tr>\n";
}
$sHtml .= "</table>\n";
return $sHtml;
}
function myround($num1) {
return intval($num1 + ( 0 < $num1 ? 0.5 : -0.5 ));
}
function shortenUrl($url, $max = 50) {
//if ( ereg("(http[^\/]*\/\/[^\/]*\/[^\/]*\/).*(\/[^\/]*)$", $url, $regs) ) {
if ( $max < strlen($url) ) {
$iSlash = strpos($url, "/", 10);
$base = substr($url, 0, $iSlash);
$lastSlash = strrpos($url, "/");
$filename = substr($url, $lastSlash);
if ( $iSlash != $lastSlash ) {
$best = $base . "/..." . $filename;
if ( strlen($best) < $max ) {
$iSlash = strpos($url, "/", $iSlash+1);
$base = substr($url, 0, $iSlash);
if ( $iSlash != $lastSlash && (strlen($base) + strlen($filename) + strlen("/...")) < $max ) {
$best = $base . "/..." . $filename;
}
}
$url = $best;
}
}
if ( $max < strlen($url) ) {
$url = substr($url, 0, $max);
}
return $url;
};
function doSimpleCommand($query) {
global $gsAuth1, $gsAuth2;
$value = NULL;
$link = mysql_connect("examples.stevesouders.com", $gsAuth1, $gsAuth2);
if ( mysql_select_db("perfprofile") ) {
//error_log("doSimpleCommand: $query");
mysql_query($query, $link);
}
}
function doQuery($query) {
global $gsAuth1, $gsAuth2;
$value = NULL;
$link = mysql_connect("examples.stevesouders.com", $gsAuth1, $gsAuth2);
if ( mysql_select_db("perfprofile") ) {
//error_log("doQuery: $query");
$result = mysql_query($query, $link);
return $result;
}
return null;
}
function doSimpleQuery($query) {
global $gsAuth1, $gsAuth2;
$value = NULL;
$link = mysql_connect("examples.stevesouders.com", $gsAuth1, $gsAuth2);
if ( mysql_select_db("perfprofile") ) {
//error_log("doSimpleQuery: $query");
$result = mysql_query($query, $link);
$row = mysql_fetch_assoc($result);
if ( $row ) {
$aKeys = array_keys($row);
$value = $row[$aKeys[0]];
}
mysql_free_result($result);
}
return $value;
}
function createTables() {
if ( 1 == 1 ) {
$command = "create table spritemesavings (" .
"savingsid int unsigned not null auto_increment" .
", createdate int(10) unsigned not null" .
", url varchar (255) not null" .
", ib int(4)" .
", ia int(4)" .
", id int(4)" .
", sb int" .
", sa int" .
", sd int" .
", tb int(4)" .
", tc int(4)" .
", testnameid int unsigned" .
", primary key (savingsid)" .
");";
doSimpleCommand($command);
$command = "create table spritemetestnames (" .
"testnameid int unsigned not null auto_increment" .
", createdate int(10) unsigned not null" .
", testname varchar (255) not null" .
", savingsidstart int" .
", primary key (testnameid)" .
", unique key (testname)" .
");";
doSimpleCommand($command);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>SpriteMe Savings</title>
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<style>
<?php
echo spritemeStyle();
?>
</style>
</head>
<body>
<?php
echo spritemeHeader("savings");
?>
<div id=contents class=contents>
<?php
echo spritemeNav("sav");
?>
<br>
<p style="margin-top: 40px;">
<?php
echo ( array_key_exists('top', $_GET) ? "Here are the results for the Alexa U.S. Top 100. " : "Here are some recent results from SpriteMe users. " );
?>
You can record your results by clicking the "share your results" link after running SpriteMe.
See the <a href="faq.php#share">FAQ</a> for more information.
</p>
<?php
if ( array_key_exists('diff', $_GET) ) {
//echo getSavingsDiff(true, 0, 101, 102, 9999);
if ( array_key_exists('testname1', $_GET) && array_key_exists('testname2', $_GET) ) {
echo getSavingsDiffTestnames(true, $_GET['testname1'], $_GET['testname2']);
}
}
else if ( array_key_exists('top', $_GET) ) {
echo getSavings(true, 50, true);
}
else {
echo getSavings(true, 50);
}
?>
<?php
echo spritemeFooter();
?>
</div> <!-- contents -->
</body>
</html>