The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Making stats pages world-viewable?

Discussion in 'General Discussion' started by platypus, Jul 21, 2004.

  1. platypus

    platypus Member

    Joined:
    Jun 5, 2004
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    I am paranoid about security and have locked down ports like 2083 and 2087 to my IP address only. However, there is one feature I'd like to be more universally visible -- stats. I have a client who would like simple access to their domain's stats and I was wondering how I can adjust cPanel and/or create some aliases so that Webalizer and Urchin stats are visible outside of the https://x.x.x.x:2083/frontend/x/index.html framework. In fact, I don't care if the entire world can see the stats without a password, but I would rather do that then trouble my client with logging in through the cPanel interface. Plus, if I can keep my security policy simple and secure, I'll be happier. I followed some of Urchin's instructions for apparently doing the same thing, but ran into problems and was wondering if anyone had in-depth information on the process. Even without that, having globally visible Webalizer would be nice as well. Any suggestions? I'm assuming I'd need a combination of setting up an Apache alias for a domain and making changes to file ownerships or something. I'm running Redhat Enterprise 3. Thanks!!!
     
  2. casey

    casey Well-Known Member

    Joined:
    Jan 17, 2003
    Messages:
    2,303
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
  3. platypus

    platypus Member

    Joined:
    Jun 5, 2004
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Thanks! That worked perfectly. I was trying the Apache alias route, but this is clearly simpler and a better solution! Thanks!

    Still wondering about doing the same thing with Urchin, but that is lower priority now. Has anyone here "opened" up Urchin to the public? If so, how?
     
  4. keyDet79

    keyDet79 Well-Known Member

    Joined:
    May 11, 2003
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Netherlands
    A bump for this one, I would like to make Urchin available to public as well, thanks!
     
  5. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
  6. keyDet79

    keyDet79 Well-Known Member

    Joined:
    May 11, 2003
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Netherlands
  7. pavemen

    pavemen Active Member

    Joined:
    Oct 8, 2003
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    if hte profiles are the ones automatically created by urchin/cpanel then you need to delet the log and domain profiles and create them from scratch. not sure why, but thatisthe only way ihave ever been able to get urchin to process logs. and you only have to do it one time for each domain/log file.
     
  8. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    awstats ?

    Anyone know how to do this world-viewable stats stuff for AWSTATS ?

    - Scott
     
  9. Thaeke.com

    Thaeke.com Member

    Joined:
    Jul 14, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Groningen, The Netherlands
    Code:
    <?php
    //dv at josheli.com
    
    $user = 'username';//your cpanel username
    $pass = 'password';//your cpanel password
    $domain = 'yourdomain.com';//do not include 'http://' or 'www.'
    
    /*
    NO NEED TO TOUCH ANYTHING BELOW HERE
    */
    
    //retrieves the file, either .pl or .png
    function getFile($fileQuery){
      global $user, $pass, $domain;
      return file_get_contents("http://$user:$pass@$domain:2082/".$fileQuery);
    }
    
    //it's a .png file...
    if(strpos($_SERVER['QUERY_STRING'],'.png')!==false) {
      $fileQuery = $_SERVER['QUERY_STRING'];
    }
    //probably first time to access page...
    elseif(empty($_SERVER['QUERY_STRING'])){
      $fileQuery = "awstats.pl?config=$domain";
    }
    //otherwise, all other accesses
    else {
      $fileQuery = 'awstats.pl?'.$_SERVER['QUERY_STRING'];
    }
    
    //now get the file
    $file = getFile($fileQuery);
    
    //check again to see if it was a .png file
    //if it's not, replace the links
    if(strpos($_SERVER['QUERY_STRING'],'.png')===false) {
      $file = str_replace('awstats.pl', basename($_SERVER['PHP_SELF']), $file);
      $file = str_replace('="/images','="'.basename($_SERVER['PHP_SELF']).'?images',$file);
    }
    //if it is a png, output appropriate header
    else {
      header("Content-type: image/png");
    }
    
    //output the file
    echo $file;
    ?> 
     
  10. sneader

    sneader Well-Known Member

    Joined:
    Aug 21, 2003
    Messages:
    1,126
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    La Crosse, WI
    cPanel Access Level:
    Root Administrator
    Thaeke, you are the MAN! That works great -- thank you SO MUCH for sharing!!

    - Scott
     
  11. liquidcherry

    liquidcherry Well-Known Member

    Joined:
    Jan 20, 2004
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    6
    blank page for code above

    hi Theake,

    i tried your code but it shows me a blank page?
    my cpanel is @ port 2083,(i made the changes in the codesection) maybe this is the reason?
    Any help is greatly appreciated

    Liquidcherry
     
  12. gemby

    gemby Well-Known Member
    PartnerNOC

    Joined:
    Feb 16, 2002
    Messages:
    182
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Pula, Croatia
    cPanel Access Level:
    DataCenter Provider
    I have disabled url_fopen on all servers, so it has to be done with curl...i'll try to "port" it to curl :))
     
  13. Thaeke.com

    Thaeke.com Member

    Joined:
    Jul 14, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Groningen, The Netherlands
    The code is not mine, I found it on a forum (could even be this one).
     
  14. jdstallings

    jdstallings Well-Known Member

    Joined:
    Jul 27, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    AWSTATS Code

    This worked like a DREAM! THanks!
     
  15. mikbyrne

    mikbyrne Registered

    Joined:
    Apr 26, 2005
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Great code, very subtle

    This is great code, worked a treat for me too. We've been wanting to do this for a year now, I've even had a crack at it myself but didn't think of using recursive requests to the same page.

    Thanks to whoever wrote it originally.
     
  16. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Bear in mind that there is a security risk associated with that script. It contains your accounts cPanel login and passwrd and should someone gain access to your server through an exploitable script (on any domain on the whole server if you do not use phpsuexec) then the hacker would have access to your cPanel account. Food for thought.
     
Loading...

Share This Page