$mon_arr = array("", "Januari", "Februari", "Mars", "April",
"Maj","Juni", "Juli", "Augusti", "September", "Oktober",
"November", "December" );
$mail_day_arr = array();
$mail_month_arr = array();
$mail_year_arr = array();
$web_month_arr = array();
$web_year_arr = array();
//---------------------------------------------------------------
//
// Get the files
function get_files()
{
global $mon_arr;
global $mail_day_arr;
global $mail_month_arr;
global $mail_year_arr;
global $web_month_arr;
global $web_year_arr;
global $g_month;
global $g_year;
//$n_year = 0;
//$n_month = 0;
//$i = 0;
if($handle = opendir('./'))
{
while(false !== ($file = readdir($handle)))
{
// List the files
//if(($file != ".") && ($file != "..") && (is_integer(strpos($file, "mail"))))
if(($file != ".") && ($file != ".."))
{
if(is_integer(strpos($file, "mail")))
{
list($dum1, $year, $month, $day, $dum2) = split ("[_\.]", $file);
if($month == "html")
{
$mail_year_arr[$n_year++] = " $year \n";
}
else if($day == "html")
{
//$g_year = intval($year);
$m = intval($month);
$mail_month_arr[$n_month++] = " $mon_arr[$m] \n";
}
else
{
$g_month = intval($month);
$m = intval($month);
$d = intval($day);
$mail_day_arr[$i++] = " $d \n";
}
}
if(is_integer(strpos($file, "stats")))
{
# stats0302.html
//echo "$file ";
$year = substr($file, 5, 2);
if($year > "50")
$year = sprintf ("19%s", $year);
else
$year = sprintf ("20%s", $year);
//echo "$year ";
$g_year = $year;
$month = substr($file, 7, 2);
if($month == ".h")
{
$web_year_arr[$n_year++] = " $year - Hela året\n";
}
else
{
$m = intval($month);
$web_month_arr[$n_month++] = " $year - $mon_arr[$m]\n";
}
}
}
}
closedir($handle);
}
}
// End get_files
//---------------------------------------------------------------
//---------------------------------------------------------------
//
// Present web statistics
function web_stat()
{
global $mon_arr;
global $web_month_arr;
global $web_year_arr;
global $g_year;
echo " Web statistik för och.nu\n";
echo " \n";
echo " \n";
$j=0;
$jj=1;
foreach ($web_year_arr as $year)
{
//echo "\n";
//echo "$year\n";
if(strpos($year, "1998"))
{
echo " | \n";
echo " \n";
echo " | \n";
#$j++;
}
else
{
#echo "$j \n";
if(!($j%3))
{
// New row
echo " \n";
}
echo " \n";
echo " \n";
echo $year;
for ($i=0; $i<12; $i++)
{
$tmp = $i+($j*12)-12;
echo $web_month_arr[$tmp];
}
echo " \n";
echo " | \n";
}
$j++;
$jj++;
}
if(!($j%3))
{
// New row
echo " \n";
}
# and the current year
//echo "QQ:" . count($web_month_arr) . "QQQ" . ($j*12);
if(count($web_month_arr) < ($j*12))
{
echo " \n";
echo " \n";
//$year+=1;
$tmp = (int)(count($web_month_arr)/12)+1999;
$g_year = $tmp;
echo " - $tmp \n";
//echo "
- $g_year \n";
//echo "
- $year \n";
for ($i=0; $i<12; $i++)
{
$tmp = $i+($j*12)-12;
echo $web_month_arr[$tmp];
}
echo "
\n";
echo " | \n";
}
else
{
// Begining of a new year
echo " \n";
//echo "Begining of a new year";
echo " \n";
//$year+=1;
$tmp = (int)(count($web_month_arr)/12)+1999-1;
$g_year = $tmp;
echo " - $tmp \n";
//echo "
- $g_year \n";
//echo "
- $year \n";
for ($i=0; $i<12; $i++)
{
$tmp = $i+($j*12)-12;
echo $web_month_arr[$tmp];
}
echo "
\n";
echo " | \n";
}
echo " \n";
echo " \n";
}
// end web_stats
//---------------------------------------------------------------
//---------------------------------------------------------------
//
// Present mail statistics
function mail_stat()
{
global $mon_arr;
global $mail_day_arr;
global $mail_month_arr;
global $mail_year_arr;
global $g_month;
global $g_year;
echo " Mail statistik för och.nu\n";
echo " \n";
echo " $mon_arr[$g_month] månad: | ";
echo " \n";
$i=0;
foreach($mail_day_arr as $day)
{
echo $day;
$i++;
if($i>3)
{
$i=0;
echo " | \n";
echo " ";
}
}
echo " | \n";
echo " \n";
if(count($mail_month_arr))
{
echo " \n";
echo " $g_year: | ";
echo " \n";
$i=0;
foreach($mail_month_arr as $month)
{
echo $month;
$i++;
if($i>3)
{
$i=0;
echo " | ";
}
}
echo " | \n";
echo " \n";
}
if($mail_year_arr)
{
echo " \n";
echo " Gångna år: | ";
echo " \n";
$i=0;
foreach($mail_year_arr as $year)
{
echo $year;
$i++;
if($i>3)
{
$i=0;
echo " | ";
}
}
echo " | \n";
echo " \n";
}
}
// end mail_stats
//---------------------------------------------------------------
//---------------------------------------------------------------
//
// main
// Get the mail files
get_files();
// Sort them for a nince presentation
sort($web_year_arr);
sort($web_month_arr);
sort($mail_year_arr);
sort($mail_month_arr);
sort($mail_day_arr);
// and present them...
web_stat();
echo " \n";
mail_stat();
echo " \n";
echo "\n";
echo "| \n";
echo " Denna sida upprätthålls av WebMaster\n";
echo " | \n";
echo " \n";
echo " Till Index\n";
echo " | \n";
echo " \n";
echo "\n";
?>
|