AwStats plugin for DA [Still in BETA]

Just found a small bug when using the plugin with users with multiple domains and certain skins. (But i've got a fix ready :-))

When users have got more than 1 domain, your code in "index.html" overwrites the $domain variable. So when you click back in (for example) the hermes skin, the domain variable is set to 1, which leads to an error from DA. This can easily be fixed by renaming the domain variable to awdomain everywhere in the file. This is probably not very clear, so here's an example line:

echo "<BLOCKQUOTE><B><BR><A HREF='?config=1&domain=$domain'>Install AwStats on this domain*</A></B><BR>";

becomes

echo "<BLOCKQUOTE><B><BR><A HREF='?config=1&awdomain=$awdomain'>Install AwStats on this domain*</A></B><BR>";

This fix is only needed with certain skins, but I thought I just let all of you know. :)

Oh, and I've got a little question too. I'm trying to improve functionality with multiple domains (I'll show it when it works), but I can't figure this out: How can I use php in the "user_txt.html" file? Any help would be apreciated!
 
Just found a small bug when using the plugin with users with multiple domains and certain skins. (But i've got a fix ready :-))

When users have got more than 1 domain, your code in "index.html" overwrites the $domain variable. So when you click back in (for example) the hermes skin, the domain variable is set to 1, which leads to an error from DA. This can easily be fixed by renaming the domain variable to awdomain everywhere in the file. This is probably not very clear, so here's an example line:

echo "<BLOCKQUOTE><B><BR><A HREF='?config=1&domain=$domain'>Install AwStats on this domain*</A></B><BR>";

becomes

echo "<BLOCKQUOTE><B><BR><A HREF='?config=1&awdomain=$awdomain'>Install AwStats on this domain*</A></B><BR>";

It's added for the next release ;) thx !

Oh, and I've got a little question too. I'm trying to improve functionality with multiple domains (I'll show it when it works), but I can't figure this out: How can I use php in the "user_txt.html" file? Any help would be apreciated!

We'll I think there's not really any php functionality in the user_txt.html. DA will just add this section to it's output of html.

I think ;)
 
I don't know what you would put php there for, but I assume the same way you do the other pages.
Haven't actually tried it though.
Code:
#!/usr/local/bin/php -c /usr/local/lib/php.ini

<?php

?>
 
Well, I'm trying to send the "domain" variable in CMD_SHOW_DOMAIN?domain=www.xxx.com to the plugin, so that I don't have to choose the domain from a list again. I allready tried that code, and it didn't work...
 
The plugin doesn't accept domains as names. It uses an ID to specify the domain. 1 = first, 2 = second etc.

This to prevent giving any random domainname to the script and so having access to someone elses domain ;)
 
I know that, but I've written some code that converts the domainname to the right number. And giving a domainname that doesn't belong to the logged in user gives an error. So no harm done by that.

Also passing around the domainname makes sure that the user doesn't have to choose a domain again when it wants to go back to the main menu.

I fixed it temporary by adding a link hard coded into the skin.

By the way, if you're interested in the code, let me know and I'll send it to you!
 
My script does the converting to numbers. DA will accept only domainnames.

The script does the following:

It reads the domainnames from the users and puts them in an array.

So 0 = the first domain etc. (mistake in my previous post)

But if you add the domain=[number] to the CMD_PLUGIN/awstats/?domain=x it should work.

Domain will be replaced with awdomain in the next release.
 
I think you don't understand why I did this. I was getting irritated by having to choose which domain I wanted to config awstats on, while I allready chose a domain when logging in as the user. So now when I click the awstats link, I automatically go to the domain I chose at the login.
Also when I return to the main menu, I won't get a list where I have to choose again. This used to be the case with the unedited plugin. But with my adjustments, I now only have to choose a domain right after login.
 
Allright, here's the code.

I replaced this loop:
PHP:
if ((sizeof($domains)>1)&&(is_null($awdomain))) {
  echo "<BLOCKQUOTE><BR><B>Select Domain to Activate</B><BR><BR>";

  for ($x=0;$x<sizeof($domains);$x++) echo "<A HREF='?awdomain=$x'>$domains[$x]</A><BR>";

  die();
} elseif (sizeof($domains)==1) $awdomain=0;
with
PHP:
if ((sizeof($domains)>1)&&(is_null($awdomain))) {
        $x=0;
        while (($x<sizeof($domains)) && ($domains[$x]<>$domain)) {
                $x++;
        }
        if ($x==sizeof($domains)) {
                echo 'Error: Domain not found';
                die();
        } else {
                $awdomain = $x;
        }
} elseif (sizeof($domains)==1) $awdomain=0;
This means that a variable $domain has to be set with the name of the allready selected domain. Also, this script will give an error if the variable is not set (which can off course be easily fixed, but wasn't nessecery for my purpose).
Because your script connects to DA as the logged in user, setting the $domain variable with a domain that doesn't belong to the user just gives an error because it won't be found in the $domains array.
 
hello,

i've created a domain ictopus.gsmedia.nl, but i can't get stats on it !

well, actually i can, but only by going to www.ictopus.gsmedia.nl/awstats, not ictopus.gsmedia.nl/awstats

for all my other domains it works like a charm! keep up the good work ;)

grtz
 
hmm .. did you happen to have already fixed that in the current version?

i justed wanted to create a symbolic link, but i got a file exists error, so i checked it out and indeed the symbolic link was already there !! and i´m absolutely sure i didn´t create it!

grtz
 
When I executed the following command:

ln -s awstats.www.fusion-ict.nl.conf awstats.fusion-ict.nl.conf

the stats works perfectly.

Edit: Looks like you already fixed it! ictopus.gsmedia.nl/awstats works perfectly.

you must look wich config you have to create by looking at the error message that awstats shows. and create the symbolic link for it in /etc/awstats


Ready for next release:

- Automatic check if SSL is in use
- Symbolic link creation
- Minor fixes

Todo for next release:

- Implementing above script to prevent second time domain selection.
- Some small fixes
 
Last edited:
Hello ;]
When I installed a Awstats I was happy, for first run of stats :( there was a 403 error :( what is going on ?? :( how to repair this ??


errors when I installed awstats for my domain:
Checking if there is already something installed..
AwStats Directory already exists on domain
Checking if awstats files are available...
Checking for AwStats itself
Awstats already exists.
(Re-)Activating CGI for dir
(Re-)Setting permissions
Now (re-)creating your configuration file.
Warning: fopen(/etc/awstats/awstats.www.thc.net.pl.conf): failed to open stream: Permission denied in /usr/local/directadmin/plugins/awstats/user/index.html on line 70 Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/directadmin/plugins/awstats/user/index.html on line 75 Warning: fclose(): supplied argument is not a valid stream resource in /usr/local/directadmin/plugins/awstats/user/index.html on line 76 Warning: symlink(): File exists in /usr/local/directadmin/plugins/awstats/user/index.html on line 77 Config file has been created and your statistics are now setup!
 
Noose: don't think your permissions in /etc/awstats are correct...

It should be available to the user under which DA runs (correct me if wrong).
 
Hello,

After today's DA upgrade awstats for all users stopped working, Error 403.

Very weird.

kamsel
 
Sorry for the late reply

Warning: fopen(/etc/awstats/awstats.www.thc.net.pl.conf): failed to open stream: Permission denied in /usr/local/directadmin/plugins/awstats/user/index.html on line 70 Warning: fwrite(): supplied argument is not a valid stream resource in /usr/local/directadmin/plugins/awstats/user/index.html on line 75 Warning: fclose(): supplied argument is not a valid stream resource in /usr/local/directadmin/plugins/awstats/user/index.html on line 76 Warning: symlink(): File exists in /usr/local/directadmin/plugins/awstats/user/index.html on line 77 Config file has been created and your statistics are now setup!

Remove your /etc/awstats dir completely. It has problems with the permission on this dir. Copy the .txt files into another dir. Just in case it can't get the old statistics back when doing a "update" on the domain.

Remove the plugin from within the control panel.

After that install the plugin again within the control panel.

Try to re-run the process. It should work correctly.

Let me know how it goes ;)
 
Back
Top