Activity Stream
48,167 MEMBERS
6802 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 8 of 8

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    Website's:
    HieBye.com BinEdris.com

    Default Give your AWSTATS with out giving your cPanel logins

    Hey guys i found this some where . Might me usefull speacially in market place for people who sell there sites for giving there stats proof () Real one




    Create a file named "awpublicstats.php"

    Put the following code in that document (Dont forget to edit the code), upload it to your root folder .
    then open it "http://www.example.com/awpublicstats.php"

    Thats it .
    Code: 
    <?php
    
    
    $user = 'YOUR CP YOURS NAME';//your cpanel username
    
    $pass = 'PASS WORD';//your cpanel password
    
    $domain = 'EXAMPLE.com';//do not include 'http://' or 'www.'
    
    
    
    /*
    
    Domain of the stats you wish to view, e.g. a subdomain like "cvs.mydomain.com".
    
    If left blank, defaults to the "domain" above
    
    Another option is to set the "config" parameter in the url of your browser, e.g.:
    
    http://www.domain.com/awstats.php?config=sub.domain.com
    
    */
    
    $config_domain = '';
    
    
    
    /*
    
    If you don't know what you're doing, set $dynamic_images equal
    
    to TRUE, and don't worry about the $image_directory variable.
    
    Otherwise,
    
        - Normally, this script will load images by proxy, i.e. awstats.php
    
          is called for each <img> tag and will send the correct
    
          image to the browser. This is not the way the web is designed
    
          to work. So, if you wish to improve performance and lower
    
          bandwidth, you can:
    
          1. Set $dynamic_images to FALSE
    
          2. Create an image directory in your webroot
    
          3. Copy all of awstats image sub-directories to this new directory
    
          4. Point the $image_directory variable to your new directory     
    
        You will get all the benefits of cached, static images.
    
        In order to get the Awstats images and their directories, you will
    
        probably need to download an awstats distribution from
    
        awstats.sourceforge.net. The final layout will probably look like this:
    
    
    
          awstats_imagedir/
    
                        browser/
    
                        clock/
    
                        cpu/
    
                        flags/
    
                        mime/
    
                        os/
    
                        other/
    
    
    
        Under each of those sub-directories will be dozens of .png files.
    
    */
    
    
    
    $dynamic_images = true;
    
    $image_directory = './awstats_images/';
    
    
    
    //lame attempt to combat referrer spam
    
    $spam_words = array('mortgage', 'sex', 'porn', 'cock', 'slut', 'facial', 'loving', 'gay', '.ro');
    
    
    
    
    
    /***********
    
    NO NEED TO TOUCH ANYTHING BELOW HERE
    
    ************/
    
    
    
    //retrieves the file, either .pl or .png
    
    function get_file($fileQuery)
    
    {
    
      global $user, $pass, $domain;
    
      return file_get_contents("http://$user:$pass@$domain:2082/".$fileQuery);
    
    }
    
    
    
    $requesting_image = (strpos($_SERVER['QUERY_STRING'],'.png')===false)?false:true;
    
    
    
    if($requesting_image) //it's a .png file...
    
    {
    
      if(!$dynamic_images && !is_dir($image_directory))
    
      {
    
        exit;
    
      }
    
      $fileQuery = $_SERVER['QUERY_STRING'];
    
    }
    
    elseif(empty($_SERVER['QUERY_STRING']))//probably first time to access page...
    
    {
    
        if(empty($config_domain))
    
        {
    
            $config_domain = $domain;
    
        }
    
      $fileQuery = "awstats.pl?config=$config_domain";
    
    }
    
    else //otherwise, all other accesses
    
    {
    
      $fileQuery = 'awstats.pl?'.$_SERVER['QUERY_STRING'];
    
    }
    
    
    
    $file = get_file($fileQuery);
    
    
    
    //check again to see if it was a .png file
    
    //if it's not, replace the links
    
    if(!$requesting_image)
    
    {
    
      $file = str_replace('awstats.pl', basename($_SERVER['PHP_SELF']), $file);
    
      
    
      if($dynamic_images)
    
      {
    
        $imgsrc_search = '="/images';
    
        $imgsrc_replace = '="'.basename($_SERVER['PHP_SELF']).'?images';
    
      }
    
      else
    
      {
    
        $imgsrc_search = 'src="/images/awstats/';
    
        $imgsrc_replace = 'src="'.$image_directory;
    
      }
    
    
    
      $file = str_replace($imgsrc_search, $imgsrc_replace, $file);
    
      $file = str_replace($spam_words, 'SPAM', $file);
    
    }
    
    else //if it is a png, output appropriate header
    
    {
    
      header("Content-type: image/png");
    
    }
    
    
    
    //output the file
    
    echo $file;
    
    ?>

    Credit goes to the original writer .

    I wish if this is sticked in the market place
    wCruiser Reviewed by wCruiser on . Give your AWSTATS with out giving your cPanel logins Hey guys i found this some where . Might me usefull speacially in market place for people who sell there sites for giving there stats proof () Real one Create a file named "awpublicstats.php" Put the following code in that document (Dont forget to edit the code), upload it to your root folder . then open it "http://www.example.com/awpublicstats.php" Rating: 5


  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    WareztheDDL.com GTFO.ws
    nice, thanks mate, will come in handy

  4.     
    #3
    Member
    Website's:
    Plutost.com OffshorePort.net Desi-Mobilez.com PhotoshopDesigner.co.uk TutsBy.me BabesWallpapers.net
    o.o !
    Thanks buddy its really an awesome topic
    Must be Stickied !
    Plutost.com Asia & Europe Hosting Provider / Offshore Shared/VPS Hosting / Even Better than Gold
    WHMCS License Verify (Catch those scam hosts)
    Tutorials By .Me

  5.     
    #4
    Member
    Website's:
    forumflare.com
    Nice tut man

    Thanks.

  6.     
    #5
    Member
    Website's:
    viz0n.net SolidNode.com r00tsecurity.org
    IMPORTANT SECURITY NOTE:

    Create a configpass.php file and chmod it to 400 and then call it with an include in the awpublicstats.php(assuming you are running suexec), otherwise you are asking to get owned when someone accesses that file from a shell loaded on the server.

    Yes, openbase_dir can be bypassed and you should ALWAYS assume that it can be.
    ******** ▌| SolidNode.com - *QUALITY OFFSHORE* [100+ clients strong]
    ******** ▌| For official support, please e-mail support@solidnode.com.
    ******** ▌| We run well managed servers with Basic DDoS Protection.
    ******** ▌| We also do Server/Site Management/Setup

  7.     
    #6
    Member
    Website's:
    HieBye.com BinEdris.com
    Quote Originally Posted by Viz0n View Post
    IMPORTANT SECURITY NOTE:

    Create a configpass.php file and chmod it to 400 and then call it with an include in the awpublicstats.php(assuming you are running suexec), otherwise you are asking to get owned when someone accesses that file from a shell loaded on the server.

    Yes, openbase_dir can be bypassed and you should ALWAYS assume that it can be.
    I am not sure , well if some reputed knows this i will be happy to change / add on the first post.


  8.     
    #7
    Member
    Website's:
    InvestDude.com
    he is "reputed" my frnd
    InvestDude.com Learn to make money by investing in hyips (high yield investment programs), affiliate marketing and tons of other method ;)

  9.     
    #8
    It begins...
    OR
    You can always use DirectAdmin as your Control Panel, which basically creates a symlink to the awstats file within public_html for the actual stats that are located outside of public_html.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Awstats not showing countries name
    By saini in forum Webmaster Discussion
    Replies: 0
    Last Post: 19th May 2012, 03:31 AM
  2. Replies: 33
    Last Post: 8th Mar 2012, 09:46 AM
  3. Installing awstats in cpanel
    By saini in forum Webmaster Discussion
    Replies: 6
    Last Post: 1st Dec 2011, 05:32 PM
  4. How to remove awstats?
    By Hillside in forum Technical Help Desk Support
    Replies: 6
    Last Post: 10th Jul 2011, 01:32 AM
  5. awstats
    By tom247 in forum General Discussion
    Replies: 8
    Last Post: 2nd Jul 2010, 04:22 PM

Tags for this Thread

BE SOCIAL