[advanced search]
NamePros Domain Auction
Live Event This Thursday at 6PM EDT - Prebidding open now
14 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Webmaster Tutorials
User Name
Password

Old 10-26-2006, 11:39 PM   · #1
Marcvs
DNOA Member
 
Location: Sparkling Bottled Awsome Country
Trader Rating: (26)
Join Date: Jan 2006
Posts: 876
NP$: 361.00 (Donate)
Marcvs is just really niceMarcvs is just really niceMarcvs is just really niceMarcvs is just really nice
[TUTORIAL] Get Awstats outside of cpanel

Here is a more secure version of getting your awstats outside of cpanel.

Demo

Rep Appreciated

First Create a file called;

awconfig.php

enter this into it (edit to suit your domain)

PHP Code:
<?

$user
= 'cpusername';//your cpanel username
$pass = 'pass';//your cpanel password
$domain = 'onebuckdirectory.com';//do not include 'http://' or 'www.'

$config_domain = 'onebuckdirectory.com'; //The Domain You want the Awstats to show (can be altered in browser)

$dynamic_images = true; //Ignore at the moment
$image_directory = './awstats_images/'; //Ignore at the moment!

?>


Then create a second file called index.php

Put This code in (no need to edit anything)

PHP Code:
<?


require ('awconfig.php');

//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;
?>


Then upload both to your webserver in an awstats directory and away you go, i will soon do a version where the config is outside the public_html folder.

Marcvs


Please register or log-in into NamePros to hide ads
__________________

MedievalTW - $1 Links - Looking for someone to buy enough stuff to help me get my new computer

Last edited by Marcvs : 11-03-2006 at 12:02 PM.
Marcvs is offline   Reply With Quote
Old 10-27-2006, 05:25 AM   · #2
JanineXD
Senior Member
 
JanineXD's Avatar
 
Name: onefour3.com
Location: Philippines
Trader Rating: (76)
Join Date: May 2006
Posts: 1,939
NP$: 195.45 (Donate)
JanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant futureJanineXD has a brilliant future
Cystic Fibrosis Save a Life
Wow.
I really need this.
i'll try this if it'll work
rep added
JanineXD is offline   Reply With Quote
Old 10-27-2006, 07:48 AM   · #3
Marcvs
DNOA Member
 
Location: Sparkling Bottled Awsome Country
Trader Rating: (26)
Join Date: Jan 2006
Posts: 876
NP$: 361.00 (Donate)
Marcvs is just really niceMarcvs is just really niceMarcvs is just really niceMarcvs is just really nice
if you get an error just reply here and ill bug check it!

updated to!
__________________

MedievalTW - $1 Links - Looking for someone to buy enough stuff to help me get my new computer
Marcvs is offline   Reply With Quote
Old 10-28-2006, 02:57 AM   · #4
unknownserv
NamePros Regular
 
Trader Rating: (4)
Join Date: Apr 2006
Posts: 261
NP$: 27.50 (Donate)
unknownserv is on a distinguished road
Shows this for a PNG file:
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/stats/index.php:1) in /home/user/public_html/stats/index.php on line 60
unknownserv is offline   Reply With Quote
Old 10-28-2006, 04:07 AM   · #5
Marcvs
DNOA Member
 
Location: Sparkling Bottled Awsome Country
Trader Rating: (26)
Join Date: Jan 2006
Posts: 876
NP$: 361.00 (Donate)
Marcvs is just really niceMarcvs is just really niceMarcvs is just really niceMarcvs is just really nice
which PNG?
__________________

MedievalTW - $1 Links - Looking for someone to buy enough stuff to help me get my new computer
Marcvs is offline   Reply With Quote
Old 10-28-2006, 05:11 AM   · #6
unknownserv
NamePros Regular
 
Trader Rating: (4)
Join Date: Apr 2006
Posts: 261
NP$: 27.50 (Donate)
unknownserv is on a distinguished road
Any, I think.
unknownserv is offline   Reply With Quote
Old 10-28-2006, 05:18 AM   · #7
Marcvs
DNOA Member
 
Location: Sparkling Bottled Awsome Country
Trader Rating: (26)
Join Date: Jan 2006
Posts: 876
NP$: 361.00 (Donate)
Marcvs is just really niceMarcvs is just really niceMarcvs is just really niceMarcvs is just really nice
hmm :S

anyone else got this problem...

ill finish of the dynamic images one which is morre advanced but harder to do
__________________

MedievalTW - $1 Links - Looking for someone to buy enough stuff to help me get my new computer
Marcvs is offline   Reply With Quote
Old 12-13-2006, 06:19 AM   · #8
eNOOBz
New Member
 
eNOOBz's Avatar
 
Trader Rating: (0)
Join Date: Dec 2006
Posts: 3
NP$: 0.00 (Donate)
eNOOBz is an unknown quantity at this point
Hi Marcvs,

How do you make the Awstats to 'Update Now'?. Thanks.
__________________
The Internet Newbie Universe
eNOOBz is offline   Reply With Quote
Old 12-13-2006, 04:17 PM   · #9
PolurNET
₪NamePros Elite™
 
PolurNET's Avatar
 
Name: Anand | Starting Law School!
Location: Montreal, Canada ... moving to Kingston, Ontario in August!
Trader Rating: (100)
Join Date: Jul 2004
Posts: 2,958
NP$: 785.30 (Donate)
PolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant futurePolurNET has a brilliant future
Member of the Month
January 2007 Alzheimer's Cancer Survivorship Third World Education Autism Save a Life Cystic Fibrosis Parkinson's Disease Lou Gehrig's Disease (ALS) Autism Multiple Sclerosis SIDS
Originally Posted by eNOOBz
Hi Marcvs,

How do you make the Awstats to 'Update Now'?. Thanks.



Step 1: Go to /tmp/awstats/

Step 2: Edit awstats.yourdomain.com.conf and change AllowToUpdateStatsFromBrowser=0 to AllowToUpdateStatsFromBrowser=1

Step 3: Goto Awstats and use the Update Now button/link which will now appear
__________________
•• PolurNET Communications •• Avoid the Freeze, Enjoy the Breeze!
= A very special day, February 12th =
Proudly #1 on NamePros and WebHostingJury for over 3 years!
||LawPoint.org •• GREAT UK HOSTING DEALS NOW AT: ExcellentHost.com ••
PolurNET is offline   Reply With Quote
Old 12-14-2006, 07:21 AM   · #10
eNOOBz
New Member
 
eNOOBz's Avatar
 
Trader Rating: (0)
Join Date: Dec 2006
Posts: 3
NP$: 0.00 (Donate)
eNOOBz is an unknown quantity at this point
Thanks polurNET but my hosting admin has just do that for me. Anyway thanks for the tip.
__________________
The Internet Newbie Universe
eNOOBz is offline   Reply With Quote
Old 12-14-2006, 08:03 PM   · #11
cyberoptik
NamePros Regular
 
Name: Ron
Location: Chicago Burbs
Trader Rating: (40)
Join Date: Aug 2003
Posts: 941
NP$: 0.01 (Donate)
cyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of lightcyberoptik is a glorious beacon of light
Heres another link, you could probably use it for fixing any bugs (I haven't tested this)

http://wiki.jumba.com.au/wiki/View_...tside_of_cPanel
__________________
Chicago Web Design
cyberoptik is offline   Reply With Quote
Old 02-15-2007, 03:10 PM   · #12
YesBrilliant
Account Closed
 
Trader Rating: (21)
Join Date: Sep 2006
Posts: 1,075
NP$: 0.00 (Donate)
YesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to allYesBrilliant is a name known to all
Originally Posted by PolurNET
Step 1: Go to /tmp/awstats/

Step 2: Edit awstats.yourdomain.com.conf and change AllowToUpdateStatsFromBrowser=0 to AllowToUpdateStatsFromBrowser=1

Step 3: Goto Awstats and use the Update Now button/link which will now appear


That is very useful.

Thanks for sharing.
YesBrilliant is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
http://www.mobisitetrader.com/ Find out how! Proof is in the Parking
Advertise your business at NamePros
All times are GMT -7. The time now is 04:31 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0