(Tips & Tricks) awstats

April 5, 2014

awstats, en zeker awstats.pl, wil je wel achter een wachtwoord.

Heb je meerdere gebruikers dan kunnen die na inloggen wel nog steeds statistieken van anderen bekijken.
Zo kun je bij de url: http://www.kwalinux.nl/awstats.pl?config=www.kwalinux.nl
config=www.kwalinux.nl bv. veranderen in config=www.all-stars.nl en dan zie je de statistieken van www.all-stars.nl.

Dit is niet altijd wenselijk en daartoe heb ik een kleine aanpassing in awstats.pl gemaakt:

use CGI; use lib '/vol/www/stats/'; use userconfigs; my $cgi = new CGI(); my $cfg = $cgi->param('config'); if ($cfg ne $usercfg{"$ENV{'REMOTE_USER'}"}) { print "Content-type: text/html\n\n<html><head></head><body> <h3>Error:</h3>Not a valid user for this config.</br> Edit /vol/www/stats/userconfigs.pm </body></html>"; exit; }

En /vol/www/stats/userconfigs.pm:

package userconfigs; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(%usercfg); %usercfg = ( "userX" => "www.siteX.com", "userY" => "www.siteY.nl", ..., );

 
"There are two kinds of people: those who do the work and those who take the credit. Try to be in the first group; there is much less competition"

Powered by Wordpress. Theme by Shlomi Noach, openark.org
© 1997 - 2024 KwaLinux Trainingen | Algemene voorwaarden | KvK: 10147727 | BTW-id: NL001873211B65 | Disclaimer