diff -rupN jawstats/clsAWStats.php jawstats-20100901-compuccino/clsAWStats.php
--- jawstats/clsAWStats.php	2009-01-25 13:49:54.000000000 +0100
+++ jawstats-20100901-compuccino/clsAWStats.php	2010-08-31 12:48:53.000000000 +0200
@@ -42,13 +42,10 @@
       // validate dates
       $dtDate = ValidateDate($iYear, $iMonth);
       $this->iYear = date("Y", $dtDate);
-      $this->iMonth = date("n", $dtDate);
+      $this->iMonth = date("m", $dtDate);
 
       // load data
       $sFilePath .= "awstats";
-      if ($this->iMonth < 10) {
-        $sFilePath .= "0";
-      }
       $sFilePath .= ($this->iMonth . $this->iYear . "." . $sStatName . ".txt");
       if (is_readable($sFilePath)) {
         $this->sAWStats = htmlspecialchars(file_get_contents($sFilePath));
@@ -205,7 +202,7 @@
     	$iEndPos = strpos($this->sAWStats, ("\nEND_" . $sSection), $iStartPos);
     	$arrStat = explode("\n", substr($this->sAWStats, ($iStartPos + 1), ($iEndPos - $iStartPos - 1)));
   		for ($iIndex = 1; $iIndex < count($arrStat); $iIndex++) {
-  			$arrData[] = split(' ', $arrStat[$iIndex]);
+  			$arrData[] = explode(' ', $arrStat[$iIndex]);
   		}
   		return $arrData;
     }
@@ -524,12 +521,12 @@
         $sCSS = " class=\"selected\"";
       }
       $aHTML[] = "<li" . $sCSS . " onclick=\"ChangeSite('" . $sSiteCode . "')\">" .
-                 (((isset($aSite["sitename"]) == true) && (strlen(trim($aSite["sitename"])) > 0)) ? $aSite["sitename"] : $aSite["siteurl"]) . "</li>";
+          (((isset($aSite["sitename"]) == true) && (strlen(trim($aSite["sitename"])) > 0)) ? $aSite["sitename"] : $aSite["siteurl"]) . "</li>";
       $i++;
       if (($i == $iColA) || ($i == $iColB)) {
         $aHTML[] = "</ul>\n</td>\n<td><ul>";
         if (count($GLOBALS["aConfig"]) == 2) {
-          $aHTML[] = "<li>&nbsp;</li>";
+//          $aHTML[] = "<li>&nbsp;</li>";
         }
       }
     }
@@ -628,4 +625,4 @@
     return $bValid;
   }
 
-?>
\ No newline at end of file
+?>
diff -rupN jawstats/clsSwitchConfig.php jawstats-20100901-compuccino/clsSwitchConfig.php
--- jawstats/clsSwitchConfig.php	1970-01-01 01:00:00.000000000 +0100
+++ jawstats-20100901-compuccino/clsSwitchConfig.php	2010-09-01 13:09:11.747381961 +0200
@@ -0,0 +1,106 @@
+<?php
+
+/*
+ * JAWStats 0.7 Web Statistics
+ *
+ * Copyright (c) 2010 Compuccino Roggenkamp & Cserny GbR
+ * Class clsSwitchConfig written by sebastian@compuccino.com
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/* USAGE
+$sc = new clsSwitchConfig('users.ini');
+
+if ( $sc->User('sebastian') === TRUE ) {
+    foreach ($sc->aIncludes as $inc) {
+        require_once($inc);
+    }
+}
+
+*/
+class clsSwitchConfig {
+    var $sUser = '';
+    var $aUsers = array();
+    var $sSitePath = '../sites/'; /* TODO should be a config variable */
+    var $aIncludes = array();
+
+    function clsSwitchConfig($userfile) {
+        $this->_loadUsers($userfile);
+    }
+
+    public function User($user) {
+
+        $this->sUser = $user;
+        if ( !isset($this->sUser) ) {
+            error_log("Error: jawstats: SwitchConfig: no user set");
+            return FALSE;
+        }
+           
+        if ( strlen($this->sUser) == 0) {
+            error_log("Error: jawstats: SwitchConfig: no user set");
+            return FALSE;
+        }
+
+        foreach ($this->aUsers as $sName => $aSites) {
+            /* compare http auth username with the username 
+             * from the users.ini */
+            if (strcmp($this->sUser, $sName) === 0) {
+                if (is_array($aSites) && (count($aSites) > 0)) {
+                    foreach ($aSites as $sSite) {
+                        $sSiteFile = $this->sSitePath . $sSite . '.php';
+                        if (file_exists($sSiteFile)) {
+                            $this->aIncludes[] = $sSiteFile;
+                        } else {
+                            error_log("Error: jawstats: could not find site config $sSiteFile");
+                            return FALSE;
+                        }
+                    }
+                } else {
+                    error_log('Error: jawstats: no sites configured for user ' . $this->sName);
+                    return FALSE;
+                }
+            }
+        }
+        if (count($this->aIncludes) > 0) {
+            return TRUE;
+        }
+
+        error_log("Error: jawstats: hmm...something was wrong...");
+        return FALSE;
+    }
+
+    private function _loadUsers($userfile) {
+        if ( !file_exists($userfile) ) {
+            error_log("Error: jawstats: $userfile file does not exist");
+        }
+        $res = parse_ini_file ($userfile);
+        if ($res !== FALSE) {
+            $this->aUsers = $res;
+        } else {
+            error_log("jawstats: could not read ini file $userfile");
+            $this->aUsers = array();
+        }
+    }
+}
+
diff -rupN jawstats/index.php jawstats-20100901-compuccino/index.php
--- jawstats/index.php	2009-01-25 14:55:21.000000000 +0100
+++ jawstats-20100901-compuccino/index.php	2010-09-01 13:11:12.197382582 +0200
@@ -37,9 +37,20 @@
   $g_aCurrentTranslation = array();
 
 	// includes
-	require_once "clsAWStats.php";
+  require_once "clsAWStats.php";
   require_once "languages/translations.php";
   require_once "config.php";
+  
+  if ( isset($_SERVER['PHP_AUTH_USER']) ) {
+    require_once "clsSwitchConfig.php";
+    $sc = new clsSwitchConfig('../users.ini');
+    if ( $sc->User($_SERVER['PHP_AUTH_USER']) === TRUE ) {
+      foreach ($sc->aIncludes as $inc) {
+        require_once "$inc";
+      }
+    }
+  }
+
   ValidateConfig();
 
   // select configuraton and translations
@@ -254,7 +265,8 @@
 
 </html>
 
-<?
+<?php
+
 
   // output booleans for javascript
   function BooleanToText($bValue) {
@@ -359,4 +371,4 @@
     }
   }
 
-?>
\ No newline at end of file
+?>
diff -rupN jawstats/xml_history.php jawstats-20100901-compuccino/xml_history.php
--- jawstats/xml_history.php	2009-01-24 00:00:18.000000000 +0100
+++ jawstats-20100901-compuccino/xml_history.php	2010-08-31 12:39:28.000000000 +0200
@@ -31,6 +31,16 @@
   require_once "config.php";
   require_once "clsAWStats.php";
 
+  if ( isset($_SERVER['PHP_AUTH_USER']) ) {
+    require_once "clsSwitchConfig.php";
+    $sc = new clsSwitchConfig('../users.ini');
+    if ( $sc->User($_SERVER['PHP_AUTH_USER']) === TRUE ) {
+      foreach ($sc->aIncludes as $inc) {
+        require_once "$inc";
+      }
+    }
+  }
+
   // external include files
   if ((isset($g_aConfig["includes"]) == true) && (strlen($g_aConfig["includes"]) > 0)) {
     $aIncludes = explode(",", $g_aConfig["includes"]);
@@ -112,4 +122,4 @@
   $aXML[] = "</data>";
   $aXML[] = "<info lastupdate=\"" . $iMaxLastUpdate . "\" />\n";
   $clsAWStats->OutputXML(implode("", $aXML));
-?>
\ No newline at end of file
+?>
diff -rupN jawstats/xml_pages.php jawstats-20100901-compuccino/xml_pages.php
--- jawstats/xml_pages.php	2009-01-24 00:00:06.000000000 +0100
+++ jawstats-20100901-compuccino/xml_pages.php	2010-08-31 12:39:53.000000000 +0200
@@ -31,6 +31,17 @@
   require_once "config.php";
   require_once "clsAWStats.php";
 
+  if ( isset($_SERVER['PHP_AUTH_USER']) ) {
+    require_once "clsSwitchConfig.php";
+    $sc = new clsSwitchConfig('../users.ini');
+    if ( $sc->User($_SERVER['PHP_AUTH_USER']) === TRUE ) {
+      foreach ($sc->aIncludes as $inc) {
+        require_once "$inc";
+      }
+    }
+  }
+
+
   // external include files
   if ((isset($g_aConfig["includes"]) == true) && (strlen($g_aConfig["includes"]) > 0)) {
     $aIncludes = explode(",", $g_aConfig["includes"]);
@@ -52,4 +63,4 @@
   // create xml
   $clsAWStats->OutputXML($clsAWStats->CreatePagesXMLString());
 
-?>
\ No newline at end of file
+?>
diff -rupN jawstats/xml_stats.php jawstats-20100901-compuccino/xml_stats.php
--- jawstats/xml_stats.php	2009-01-23 23:59:51.000000000 +0100
+++ jawstats-20100901-compuccino/xml_stats.php	2010-08-31 12:40:02.000000000 +0200
@@ -31,6 +31,17 @@
   require_once "config.php";
   require_once "clsAWStats.php";
 
+  if ( isset($_SERVER['PHP_AUTH_USER']) ) {
+    require_once "clsSwitchConfig.php";
+    $sc = new clsSwitchConfig('../users.ini');
+    if ( $sc->User($_SERVER['PHP_AUTH_USER']) === TRUE ) {
+      foreach ($sc->aIncludes as $inc) {
+        require_once "$inc";
+      }
+    }
+  }
+
+
   // external include files
   if ((isset($g_aConfig["includes"]) == true) && (strlen($g_aConfig["includes"]) > 0)) {
     $aIncludes = explode(",", $g_aConfig["includes"]);
@@ -71,4 +82,4 @@
       break;
   }
 
-?>
\ No newline at end of file
+?>
diff -rupN jawstats/xml_update.php jawstats-20100901-compuccino/xml_update.php
--- jawstats/xml_update.php	2009-01-23 23:59:37.000000000 +0100
+++ jawstats-20100901-compuccino/xml_update.php	2010-08-31 12:40:09.000000000 +0200
@@ -30,6 +30,16 @@
 	// includes
   require_once "config.php";
 
+  if ( isset($_SERVER['PHP_AUTH_USER']) ) {
+    require_once "clsSwitchConfig.php";
+    $sc = new clsSwitchConfig('../users.ini');
+    if ( $sc->User($_SERVER['PHP_AUTH_USER']) === TRUE ) {
+      foreach ($sc->aIncludes as $inc) {
+        require_once "$inc";
+      }
+    }
+  }
+
   // external include files
   if ((isset($g_aConfig["includes"]) == true) && (strlen($g_aConfig["includes"]) > 0)) {
     $aIncludes = explode(",", $g_aConfig["includes"]);

