<?php
#############################################################
# Project:      bCounter                                    #
# File:         inc.php                                     #
# Decription:   include all needed files
#                                                           #
# Copyright (c) Alexander Bondar (http://bondar.de/)        #
#############################################################

    global $bCounter_inc_dir;
    $bCounter_inc_dir = dirname(__FILE__);

    global $bCounter_SID;
    $bCounter_SID = session_id();

    require_once( $bCounter_inc_dir."/core/settings_default.php" );
    require_once( $bCounter_inc_dir."/../settings.php" );
    require_once( $bCounter_inc_dir."/core/class.database.php" );
    require_once( $bCounter_inc_dir."/core/class.bcounter.php" );
    require_once( $bCounter_inc_dir."/core/class.user.php" );
    require_once( $bCounter_inc_dir."/core/functions.php" );
    require_once( $bCounter_inc_dir."/core/ua_get_data.php" ); // User Agent-Funktionen: Bestimmung
    require_once( $bCounter_inc_dir."/core/ua_output.php" ); // User Agent-Funktionen: Ausgabe

    global $bCounter_version;
    $bCounter_version = "0.3";

    global $bCounter;
    $bCounter = new bCounter();

    global $bCounterDB;
    $bCounterDB = new bCounterDB($bCounter_dbServer, $bCounter_dbDatabase, $bCounter_dbUser, $bCounter_dbPassword);

    global $bCounterUser;
    $bCounterUser = new bCounterUser($bCounterDB);

    $strHost_ohneWWW = preg_replace ( '^www\.^' , "" , $_SERVER["SERVER_NAME"] );
    $strHost_mitWWW = "www.".$strHost_ohneWWW;

    global $arrIgnoreReferer;
    $arrIgnoreReferer[] = $strHost_ohneWWW;
    $arrIgnoreReferer[] = $strHost_mitWWW;

    $arrAlpha2name = array();
    $strSQLstring = "SELECT DISTINCT alpha2, name FROM ".$bCounter_dbPrefix."iplist";
    $SQLresult = $bCounterDB->query($strSQLstring);
    for ( $i = 0; $i < @mysql_num_rows($SQLresult); $i++ ) {
        $arrAlpha2name[strtolower(mysql_result($SQLresult, $i, "alpha2"))] = ucwords(strtolower(mysql_result($SQLresult, $i, "name")));
    }
    $arrAlpha2name["zz"] = "Netzwerk";
?>