@@ -43,23 +43,17 @@ if ($handle = opendir('.'))
4343arsort($awprev);
4444
4545$options = "";
46- foreach ($awprev as $key => $value)
47- {
48-
49- if(file_exists($value.'/awsindex.html') && file_exists($value.'/goaindex.html')) {
50- $awstatsindex = 'awsindex.html';
51- } elseif(file_exists($value.'/awsindex.html') && !file_exists($value.'/goaindex.html')) {
52- $awstatsindex = 'awsindex.html';
53- } else {
54- $awstatsindex = 'goaindex.html';
55- }
56-
46+ foreach ($awprev as $key => $value) {
47+ // Define name for the index file
48+ $awstatsindex = 'awsindex.html';
49+ if(!file_exists($value.'/awsindex.html') && file_exists($value.'/goaindex.html')) {
50+ $awstatsindex = 'goaindex.html';
51+ }
52+ // Set name for first entry in month list
5753 if($key == $current) $options .= "<option selected=\"selected\" value=\"{$awstatsindex}\">{$value}</option>\n";
5854 else $options .= "<option value=\"{$value}/{$awstatsindex}\">{$value}</option>\n";
5955}
6056
61- $awstatsindex = 'awsindex.html';
62-
6357$html = "<!DOCTYPE html>\n<html>\n<head>\n<title>Stats</title>\n";
6458$html .= "<style>\nhtml,body {margin:0px;padding:0px;width:100%;height:100%;background-color: #ccc;}\n";
6559$html .= "#header\n{\nwidth:100%;margin:0px auto;\nheight:20px;\nposition:fixed;\npadding:4px;\ntext-align:center;\n}\n";
@@ -68,7 +62,7 @@ $html .= $script;
6862$html .= "<div id=\"header\">{$yearmonth_text}\n";
6963$html .= "<select name=\"awdate\" onchange=\"load_content(this.value)\">\n";
7064$html .= $options;
71- $html .= "</select>\n</div>\n<iframe src=\"{$awstatsindex} \" id=\"content\"></iframe>\n";
65+ $html .= "</select>\n</div>\n<iframe src=\"awsindex.html \" id=\"content\"></iframe>\n";
7266$html .= "</body></html>";
7367echo $html;
7468?>
0 commit comments