Index: [Article Count Order] [Thread]

Date:  Tue, 19 Oct 2004 10:43:49 +0200
From:  =?us-ascii?Q?Trond_Huso?= <tr-huso (at mark) online.no>
Subject:  [coba-e:01268] SV:  Webalizer solution no need for htaccess
To:  <coba-e (at mark) bluequartz.org>
Message-Id:  <004601c4b5b7$c2b040f0$0201a8c0@mainpc>
In-Reply-To:  <20041018222831.55824F8E8 (at mark) smtp.bulldogdsl.com>
X-Mail-Count: 01268

Hi Leigh,

=20

Great solution. What you now can do is to put webalizer (stats) =
directory
out of the web-root structure. That way no one but those in the BQ GUI =
can
see the stats.

=20

-trond-

=20

=20

-----Opprinnelig melding-----
Fra: Leigh Blackwell [mailto:leigh (at mark) codacommerce.com]=20
Sendt: 19. oktober 2004 00:28
Til: coba-e (at mark) bluequartz.org
Emne: [coba-e:01265] Webalizer solution no need for htaccess

=20

Hi All,

=20

I gave up playing around with htaccess and took an idea from Trond Husoe =
and
placed the Webalizer content in the gui and over came the problem of =
links.
This solution allows the webalizer pages and images to remain in the =
vhost
accounts and stream them securely via a php page in the admin area. The
result is a pretty cool.

=20

Two files will do the trick, providing you have got webalizer to run and
generate content, once you copied the content below you will find the
Webalizer link in the Usage Information on the Virtual Site menu.=20

=20

I have this running on BQ FC1. This is my first attempt with php and I'm
happy to have some feed back..

=20

Cheers

=20

Leigh

=20

=20

=20

/usr/sausalito/ui/menu/webalizer.xml

=20

<item id=3D"base_webalizer"

   label=3D"Webalizer"

   description=3D"Webalizer Statistics."

   url=3D"/base/sitestats/webalizer.php?group=3D[[VAR.group]]" >

   <parent id=3D"base_siteusage" order=3D"20"/>

</item>

=20

=20

=20

/usr/sausalito/ui/web/base/sitestats/webalizer.php

=20

<?php

=20

include_once('ServerScriptHelper.php');

=20

$helper =3D& new ServerScriptHelper();

$factory =3D& $helper->getHtmlComponentFactory('base-ssl',
'/base/ssl/siteSSL.php');

$cce =3D& $helper->getCceClient();

$page =3D $factory->getPage();

$i18n =3D& $factory->getI18n();

=20

if ($group)

{

    list($oid) =3D $cce->find('Vsite', array('name' =3D> $group));

    $vsite_info =3D $cce->get($oid);

    $fqdn =3D $vsite_info['fqdn'];

}

=20

if (!$file)

{

$file =3D "index.html";

}

=20

$fullPath =3D "/home/sites/" . $vsite_info['fqdn'] . "/web/stats/" . =
$file;

=20

if (preg_match('/html/', $file)){

print $page->toHeaderHtml();

}

=20

if (file_exists($fullPath)){

=20

        $fp =3D fopen ($fullPath, "r");

=20

        $data =3D "";

        while(!feof($fp))

        {

                $string =3D fgets($fp, 4096);

                $string=3Dstr_replace("<A HREF=3D\"usage", "<A
HREF=3D\"webalizer.php?group=3D" . $group . "&file=3Dusage", $string);

                $string=3Dstr_replace("<IMG SRC=3D\"", "<IMG
SRC=3D\"webalizer.php?group=3D" . $group . "&file=3D", $string);

                $data .=3D $string;

        }

=20

        echo $data;

=20

        @flose($fp);

=20

}else{

=20

        echo "<h4>Page not Found</h4>" . $fullPath;

=20

}

=20

if (preg_match('/html/', $file)){

print $page->toFooterHtml();

}

=20

exit ();

=20

?>


	

1268_2.html (attatchment)