Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

AWstats access outside cPanel

Discussion in 'General Discussion' started by equo25, Jun 28, 2017.

Tags:
  1. equo25

    equo25 Member

    Joined:
    Jun 28, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Reseller Owner
    Hello everybody,
    I has a reseller account and before last update I was able to give customers an access to awstats page from outside cpanel, using a simple php code and a config file into a password protected directory. This index.php was able to access awstats page via port 2083 and customer easily read his stats. After last update this is not working anymore.
    Got similar experience? Is anybody able to solve it?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    There is no native functionality that will allow access or reports from Awstats without first logging in via cPanel. However, I encourage you to vote and add feedback to the existing feature request at:

    Feature Request - View Awstats without accessing cPanel

    As far as why your script stopped working, it's possibly related to the removal of the X3 theme from the product. Review your script to see if some of the links you were using have changed since the switch to Paper Lantern.

    Thank you.
     
  3. equo25

    equo25 Member

    Joined:
    Jun 28, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Reseller Owner
    Ok, encouraging the future request is a good idea... Anyway, I found a php code that allowed to do that, but this is not working anymore. Have been made changes in cpanel? Or simply server's admin closed 2083 door?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    It's possibly related to the removal of the X3 theme from the product. Review your script to see if some of the links have changed since the switch to Paper Lantern.

    Thank you.
     
  5. equo25

    equo25 Member

    Joined:
    Jun 28, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Reseller Owner
    I hope that posting my script will not be a problem. It never changed since first time I uploaded... Of course, needs a config file with username and password

    Code:
    <?php
    foreach (array('_GET', '_POST', '_COOKIE', '_SERVER') as $_SG) {
      foreach ($$_SG as $_SGK => $_SGV) {
        $$_SGK = $_SGV;
      }
    }
    
    require_once("/home/gianfran/config.php");
    
    
    //retrieves the file, either .pl or .png
    function getFile($fileQuery){
    global $user, $pass, $domain;
    return file_get_contents("[URL]http://$user:$pass@$domain:2083/[/URL]".$fileQuery,'r');
    }
    
    //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;
    ?>
     
    #5 equo25, Jul 3, 2017
    Last edited by a moderator: Jul 3, 2017
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Assistance with third-party code is unavailable, but one option to consider is installing a manual copy of Awstats directly to the website instead of attempting to setup a direct link to the cPanel Awstats feature.

    Thank you.
     
  7. equo25

    equo25 Member

    Joined:
    Jun 28, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Reseller Owner
    Thank you for your suggestion. I thought to do that, but I fear that twice awstats installed (in different directories...) could be a problem or create a mismatch. Is it so? Example: I install awstats in public_html/myawstats - will this get same datas from preinstalled awstats?
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Here's a third-party URL you may find helpful:

    Access Awstats without logging into cPanel

    Thank you.
     
  9. equo25

    equo25 Member

    Joined:
    Jun 28, 2017
    Messages:
    5
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Italy
    cPanel Access Level:
    Reseller Owner
    cPanelMichael likes this.
Loading...

Share This Page