1- <script>
2- function load_content(url)
3- {
4- var iframe = document.getElementById("content");
5- iframe.src = url;
6- }
7- </script>
8-
91<?php
10- $aw['aw_jump_text'] = 'Jump to previous stats: ';
11- $aw['aw_renamed_index'] = 'fixedindex.html';
2+ $yearmonth_text = "Jump to previous stats: ";
3+ $awstatsindex = 'awsindex.html';
4+ $script = "<script>function load_content(url){var iframe = document.getElementById(\"content\");iframe.src = url;}</script>\n";
125
136if ($handle = opendir('.'))
147{
15- while(false !== ($file = readdir($handle)))
16- {
17- if (substr($file,0,1) != "." && is_dir($file))
18- {
19- $orderkey = substr($file,0,4).substr($file,5,2);
20- if (substr($file,5,2) < 10 )
21- {
22- $orderkey = substr($file,0,4)."0".substr($file,5,2);
23- }
24- $awprev[$orderkey] = $file;
25- }
26- }
27-
28- $month = date("n");
29- $year = date("Y");
30-
31- if (date("d") == 1)
32- {
33- $month = date("m")-1;
34- if (date("m") == 1)
35- {
36- $year = date("Y")-1;
37- $month = "12";
38- }
39- }
40-
41- $current = $year.$month;
42- $awprev[$current] = $year."-".$month;
43-
44- closedir($handle);
8+ while(false !== ($file = readdir($handle)))
9+ {
10+ if (substr($file,0,1) != "." && is_dir($file))
11+ {
12+ $orderkey = substr($file,0,4).substr($file,5,2);
13+ if (substr($file,5,2) < 10 ) $orderkey = substr($file,0,4)."0".substr($file,5,2);
14+ $awprev[$orderkey] = $file;
15+ }
16+ }
17+ $month = date("n");
18+ $year = date("Y");
19+ if (date("d") == 1)
20+ {
21+ $month = date("m")-1;
22+ if (date("m") == 1)
23+ {
24+ $year = date("Y")-1;
25+ $month = "12";
26+ }
27+ }
28+ $current = $year.$month;
29+ $awprev[$current] = $year."-".$month;
30+ closedir($handle);
4531}
4632
47- echo '<div style="width: 97%; margin-left: 4px; height: 20px; background-color: #FFFFFF; position: fixed; padding: 7px; border: 2px solid #cccccc;><div align="left"><font color="#000000" size="2" face="Verdana, Arial, Helvetica, sans-serif">' .$aw["aw_jump_text"]. '</font </div>';
48-
49- echo "<select name='awdate' onchange=\"load_content(this.value)\">";
50- krsort($awprev);
33+ arsort($awprev);
5134
35+ $options = "";
5236foreach ($awprev as $key => $value)
5337{
54- if($key == $current)
55- {
56- echo "<option selected=\"selected\" value=\"".$aw['aw_renamed_index']."\"> $value</option>";
57- }
58- else
59- {
60- echo "<option value='$value/".$aw['aw_renamed_index']."'> $value</option>";
61- }
38+ if($key == $current) $options .= "<option selected=\"selected\" value=\"{$awstatsindex}\">{$value}</option>\n";
39+ else $options .= "<option value=\"{$value}/{$awstatsindex}\">{$value}</option>\n";
6240}
6341
64- echo '</select></div><iframe src="'.$aw['aw_renamed_index'].'" frameborder="0" scrolling="Yes" width="100%" height="100%" style="margin-top:25px" id="content"></iframe>';
65-
42+ $html = "<!DOCTYPE html>\n<html>\n<head>\n<title>Stats</title>\n";
43+ $html .= "<style>\nhtml,body {margin:0px;padding:0px;width:100%;height:100%;background-color: #ccc;}\n";
44+ $html .= "#header\n{\nwidth:100%;margin:0px auto;\nheight:20px;\nposition:fixed;\npadding:4px;\ntext-align:center;\n}\n";
45+ $html .= "iframe {width:100%;height:90%;margin:0px;margin-top:40px;border:0px;padding:0px;}\n</style>\n</head>\n<body>\n";
46+ $html .= $script;
47+ $html .= "<div id=\"header\">{$yearmonth_text}\n";
48+ $html .= "<select name=\"awdate\" onchange=\"load_content(this.value)\">\n";
49+ $html .= $options;
50+ $html .= "</select>\n</div>\n<iframe src=\"{$awstatsindex}\" id=\"content\"></iframe>\n";
51+ $html .= "</body></html>";
52+ echo $html;
6653?>
0 commit comments