awstats_index.php.master 1.98 KB
Newer Older
1 2 3 4 5 6 7
<script>
function load_content(url)
{
    var iframe = document.getElementById("content");
    iframe.src = url;
}
</script>
tbrehm's avatar
tbrehm committed
8

9 10
<?php
$aw['aw_jump_text'] = 'Jump to previous stats: ';
tbrehm's avatar
tbrehm committed
11
$aw['aw_renamed_index'] = 'fixedindex.html';
12 13 14 15 16 17 18

if ($handle = opendir('.'))
{
        while(false !== ($file = readdir($handle)))
        {
                if (substr($file,0,1) != "." && is_dir($file))
                {
19 20 21 22 23 24
                        $orderkey = substr($file,0,4).substr($file,5,2);
                        if (substr($file,5,2) < 10 )
                        {
                                $orderkey = substr($file,0,4)."0".substr($file,5,2);
                        }
                        $awprev[$orderkey] = $file;
25 26 27
                }
        }

tbrehm's avatar
tbrehm committed
28
        $month = date("n");
29 30
        $year = date("Y");

tbrehm's avatar
tbrehm committed
31
        if (date("d") == 1)
32
        {
33
                $month = date("m")-1;
tbrehm's avatar
tbrehm committed
34 35
                if (date("m") == 1)
                {
36 37
                        $year = date("Y")-1;
                        $month = "12";
tbrehm's avatar
tbrehm committed
38
                }
39 40
        }

41 42
        $current = $year.$month;
        $awprev[$current] = $year."-".$month;
tbrehm's avatar
tbrehm committed
43

44 45 46 47 48 49
        closedir($handle);
}

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>';

echo "<select name='awdate' onchange=\"load_content(this.value)\">";
50
krsort($awprev);
51 52 53

foreach ($awprev as $key => $value)
{
54
        if($key == $current)
55 56 57 58 59 60 61 62 63 64 65
        {
                echo "<option selected=\"selected\" value=\"".$aw['aw_renamed_index']."\"> $value</option>";
        }
        else
        {
                echo "<option value='$value/".$aw['aw_renamed_index']."'> $value</option>";
        }
}

echo '</select></div><iframe src="'.$aw['aw_renamed_index'].'" frameborder="0" scrolling="Yes" width="100%" height="100%" style="margin-top:25px" id="content"></iframe>';

66
?>