• This forum has a zero tolerance policy regarding spam. If you register here to publish advertising, your user account will be deleted without further questions.

Howto wanted awstats vServer S4Y

Joker

Registered User
Ich weiß, dass das Thema AWSTATS schon mehrmals hier angesprochen wurde, aber bisher konnte mir nicht wirklich geholfen werden. Die Anleitung die dabei liegt verstehe ich auch nicht so ganz.
Was ich also suche ist ein HOWTO, was folgendes beinhaltet:
- Installation von AWSTATS auf einem vServer von Server 4 You
- jede Domain oder jeder Kunde soll nur seine eigene Statistik sehen können
- Webstatistik und Mailstatistik soll funktionieren

Danke Joker

PS: Es wollte mal jemand einen Artikel dazu schreiben, aber wo ist der?
 
Dem schliess ich mich doch glatt mal an :)
Hatte es zwar nach einigem rumprobieren hingekriegt das Perlskript via Bash manuell zu starten, aber wie man das ganze via Browser ansprechen soll ist mir nach wie vor ein Rätsel...
 
Ich hab mir mal die Mühe gemacht zu suchen und bin fündig geworden. Es gibt ein PHP Script, welches das ganze ermöglicht. Ich habe es auch auf meinem Vserver + Confixx getestet und kriege es einfach nicht zum laufen. Das Script ist so schlecht programmiert dass es nicht läuft und ich hab keine Ahnung woran es liegt.

Vielleicht macht sich jemand ja mal die Mühe und guckt woran der Fehler liegt.

Ich hab mir 3 Stunden den Kopf dran zerbrochen und habs nicht geschafft. Als erstes stlolpert man über jede Menge Syntaxfehler (die ich in den beigefügten Scripts NICHT behoben habe).

Wenn es jemand schaffen sollte das Script so umzuschreiben dass es funktioniert wäre es echt klasse wenn die berichtigten Versionen hier posten würde!
 
Script 1 (Muss ausgeführt werden vom Server):
Code:
<?PHP

$folder = "/home/www/";
$sorttype = "2";
$statsto = "";
$webstatsfolder = "/home/www/confixx/html/stats/";
$basefolder = "/home/marc/awstats/";
$appfolder = "${basefolder}app/";
$datafolder = "${basefolder}data/";
$cachefolder = "${basefolder}cache/";
$langfolder = "${basefolder}lang/";

$webuser = "confixx";
$webgroup = "users";

$mysqlhost = "localhost";
$mysqluser = "root";
$mysqlpass = "XXXX";
$mysqldb = "confixx";

include("aw_conf.php");


$conn = @mysql_connect($mysqlhost,$mysqluser,$mysqlpass);
$statsdb = mysql_select_db($mysqldb, $conn);

//READ FOLDER CONTENT-------------------------------
if ($handle = @opendir($folder)) {
$sites = Array();
    while (false !== ($file = readdir($handle))) {
        if ($file && $file !== "confixx" && $file !== "." && $file !== "..") {
           $sites[] = $file;
        }
    }
closedir($handle);
if($sorttype == "1"){
    sort($sites);
}elseif($sorttype == "2"){
    natsort($sites);
}else{
    sort($sites);
}
closedir($handle);
//READ FOLDER CONTENT-------------------------------*end*


foreach($sites as $site){
    $q = "SELECT * FROM domains WHERE kunde='$site' AND richtigedomain ='1'";
    $x = mysql_query($q);
    $d = mysql_fetch_array($x);
    $domain = trim($d[domain]);


    if(!is_dir("$webstatsfolder$domain")){
        mkdir ("$webstatsfolder$domain", 0755);
        chown("$webstatsfolder$domain","$webuser");
        chgrp("$webstatsfolder$domain","$webgroup");
    }

    if(!is_dir("$webstatsfolder$site")){
        mkdir ("$webstatsfolder$site", 0755);
        chown("$webstatsfolder$site","$webuser");
        chgrp("$webstatsfolder$site","$webgroup");
    }

        if (!$fp = fopen("$webstatsfolder$site/index.php", 'w')) {
            echo "Cannot open file ($webstatsfolder$site/index.php)n";
        }
        $indexphp = "<?php header("Location:../$domain/awstats.$domain.html");?>";
        if (!fwrite($fp, $indexphp)) {
            echo "Cannot write to file ($webstatsfolder$site/index.php)n";
         }else{
        chown("$webstatsfolder$site/index.php","$webuser");
        chgrp("$webstatsfolder$site/index.php","$webgroup");
         }
        @fclose($fp);


        $filecontent = eregi_replace("***WEB***","$site",$aw_conf_file);
        $filecontent = eregi_replace("***URL***","$d[domain]",$filecontent);
        $filecontent = eregi_replace("***DATAFOLDER***",$datafolder,$filecontent);
        $filecontent = eregi_replace("***CACHEFOLDER***",$cachefolder,$filecontent);
        $filecontent = eregi_replace("***LANGFOLDER***",$langfolder,$filecontent);
        
        if (!$fp = fopen("${appfolder}awstats.$domain.conf", 'w')) {
         echo "Cannot open file (${basefolder}awstats.$domain.conf)n";
        }
        if (!fwrite($fp, $filecontent)) {
            echo "Cannot write to file (${appfolder}awstats.$domain.conf)n";
         }else{
        chown("${appfolder}awstats.$domain.conf","$webuser");
        chgrp("${appfolder}awstats.$domain.conf","$webgroup");
        }
    @fclose($fp);
    //}


    if(!is_file("$webstatsfolder$domain/index.php")){

        if (!$fp = fopen("$webstatsfolder$domain/index.php", 'w')) {
            echo "Cannot open file ($webstatsfolder$domain/index.php)n";
        }
        $indexphp = "<?php header("Location:awstats.$domain.html");?>";
        if (!fwrite($fp, $indexphp)) {
            echo "Cannot write to file ($webstatsfolder$domain/index.php)n";
         }
        @fclose($fp);
    }

//htaccess file
        if (!$fp = fopen("$webstatsfolder$domain/.htaccess", 'w')) {
            echo "Cannot open file ($webstatsfolder$domain/.htaccess)n";
        }
        $dup = ucfirst($domain);
$htaccess = "
AuthName "$dup Stats"
AuthType Basic
AuthUserFile $webstatsfolder$domain/.htpasswd
require valid-user";
        if (!fwrite($fp, $htaccess)) {
            echo "Cannot write to file ($webstatsfolder$domain/.htaccess)n";
         }
        @fclose($fp);
//htaccess file *end*

//htpasswd file
        if (!$fp = fopen("$webstatsfolder$domain/.htpasswd", 'w')) {
            echo "Cannot open file ($webstatsfolder$domain/.htpasswd)n";
        }

$q = "SELECT * FROM kunden WHERE kunde='$site'";
$d = mysql_query($q);
$x = mysql_fetch_array($d);

$htpasswd= "$site:$x[passwort]nadmin:$x[passwort]nmarc:hjl0ArJoBW7cMnmetaph:FMig6flWOIIyQ";
        if (!fwrite($fp, $htpasswd)) {
            echo "Cannot write to file ($webstatsfolder$domain/.htpasswd)n";
         }
        @fclose($fp);//htpasswd file *end*





$shfile .= "$appfoldertools/awstats_buildstaticpages.pl -config=$domain -update -dir=$webstatsfolder$domain -awstatsprog=$appfolderawstats.pln";
$shfile .= "chown confixx $webstatsfolder$domain/ -Rnchgrp users $webstatsfolder$domain/ -Rn";
    echo"$site - $domainn";
}



$shfilewrite = "###THIS IS AN AUTOMATICALLY CREATED BASH FILE TO UPDATE AWSTATS###n###      Copyright by Marc Giombetti (marc@giombetti.com)      ###nn$shfile";
if (!$sfp = fopen("$basefolderupdateall.sh", 'w')) {
        echo "Cannot open file ($basefolderupdateall.sh)n";
}
if (!fwrite($sfp, $shfilewrite)) {
        echo "Cannot write to file ($basefolderupdateall.sh)n";
}
        chmod ("$basefolderupdateall.sh", 0777);
        @fclose($sfp);



mysql_close();
}else{
    die("Couldn't read folder content");
}

?>

Script 2(muss im gleichen Verzeichniss liegen wie Script1 und muss heissen: aw_conf.php):
Code:
<?PHP

$aw_conf_file = '
#-----------------------------------------------------------------------------
# AWSTATS CONFIGURE FILE 5.5                                                 |
#-----------------------------------------------------------------------------
# MAIN SETUP SECTION (Required to make AWStats work)                         |
#-----------------------------------------------------------------------------

LogFile="/home/www/***WEB***/log/access_log"
LogFormat=1
LogSeparator=" "
SiteDomain="***URL***"
HostAliases="localhost 127.0.0.1 ***URL***"
# 0 - No DNS Lookup
# 1 - DNS Lookup is fully enabled
# 2 - DNS Lookup is made only from static DNS cache file (if exists)
DNSLookup=1

DirData="***DATAFOLDER***"
DirCgi="/cgi-bin"
DirIcons="../../awstats_icons"
AllowToUpdateStatsFromBrowser=0

#Advanced Configuration
EnableLockForUpdate=0
DNSStaticCacheFile="dnscache.txt"
DNSLastUpdateCacheFile="***CACHEFOLDER***dnscachelastupdate.txt"
SkipDNSLookupFor=""
AllowAccessFromWebToAuthenticatedUsersOnly=0
AllowAccessFromWebToFollowingAuthenticatedUsers=""
AllowAccessFromWebToFollowingIPAddresses=""
CreateDirDataIfNotExists=1
SaveDatabaseFilesWithPermissionsForEveryone=1
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=1
DefaultFile="index.php index.php3 index.html index.htm"
SkipHosts=""
SkipUserAgents=""
SkipFiles=""
OnlyHosts=""
OnlyFiles=""
NotPageList="css js class gif jpg jpeg png bmp"
ValidHTTPCodes="200 304"
ValidSMTPCodes="1"
AuthenticatedUsersNotCaseSensitive=0
URLNotCaseSensitive=0
URLWithAnchor=0
URLQuerySeparators="?;"
URLWithQuery=0
URLWithQueryWithoutFollowingParameters=""
URLReferrerWithQuery=0
WarningMessages=1
ErrorMessages=""
DebugMessages=0
NbOfLinesForCorruptedLog=50
WrapperScript=""
DecodeUA=0
MiscTrackerUrl="/js/awstats_misc_tracker.js"



DetailedReportsOnNewWindows=1
Expires=0
MaxRowsInHTMLOutput=1000
Lang="auto"
DirLang="***LANGFOLDER***"
ShowFlagLinks="en fr de nl es pt"
ShowLinksOnUrl=1
MaxLengthOfURL=72

ShowLinksToWhoIs=1
LinksToWhoIs="http://www.whois.net/search.cgi2?str="
LinksToIPWhoIs="http://ws.arin.net/cgi-bin/whois.pl?queryinput="
Logo="awstats_logo1.png"
LogoLink="http://awstats.sourceforge.net"
BarWidth   = 260
BarHeight  = 90
StyleSheet=""
color_Background="FFFFFF"        # Background color for main page (Default = "FFFFFF")
color_TableBGTitle="CCCCDD"        # Background color for table title (Default = "CCCCDD")
color_TableTitle="000000"        # Table title font color (Default = "000000")
color_TableBG="CCCCDD"            # Background color for table (Default = "CCCCDD")
color_TableRowTitle="FFFFFF"    # Table row title font color (Default = "FFFFFF")
color_TableBGRowTitle="ECECEC"    # Background color for row title (Default = "ECECEC")
color_TableBorder="ECECEC"        # Table border color (Default = "ECECEC")
color_text="000000"                # Color of text (Default = "000000")
color_textpercent="606060"        # Color of text for percent values (Default = "606060")
color_titletext="000000"        # Color of text title within colored Title Rows (Default = "000000")
color_weekend="EAEAEA"            # Color for week-end days (Default = "EAEAEA")
color_link="0011BB"                # Color of HTML links (Default = "0011BB")
color_hover="605040"            # Color of HTML on-mouseover links (Default = "605040")
color_u="FFB055"                # Background color for number of unique visitors (Default = "FFB055")
color_v="F8E880"                # Background color for number of visites (Default = "F8E880")
color_p="4477DD"                # Background color for number of pages (Default = "4477DD")
color_h="66F0FF"                # Background color for number of hits (Default = "66F0FF")
color_k="2EA495"                # Background color for number of bytes (Default = "2EA495")
color_s="8888DD"                # Background color for number of search (Default = "8888DD")
color_e="CEC2E8"                # Background color for number of entry pages (Default = "CEC2E8")
color_x="C1B2E2"                # Background color for number of exit pages (Default = "C1B2E2")';

?>

Wie gesagt, ich hab mir jetzt 3 Stunden lang den Kopf drüber zerbrochen und es nicht geschafft.
 
Back
Top