Create AWStats for Public

by Herman Tarigan on April 13, 2006

“Bagaiana caranya supaya Web Statistik kita bisa diakses oleh publik tanpa harus login ke Cpanel?”

1. Download Awstats_Access.zip

2. Setelah itu upload dan extract di folder public_html anda contohnya akan menjadi /home/useranda/public_html/stats

3. Edit file “config.php” yang ada di folder /home/useranda/public_html/stats


<?php
$username = “user”; /* Sesuaikan dengan keinginan anda*/
$password = “pass”; /* Sesuaikan dengan keinginan anda */
$site = “yoursite.com”; /*Sesuaikan dengan nama domain anda */
$cpnlusername = “cpanelusername”;
$cpnlpassword = “cpanelpassword”;
?>

4. Setelah itu silahkan akses http://namadomainanda.com/stats

Untuk login gunakan username dan password seperti yang telah ditentukan difile “config.php” sebelumnya.

“Bagaimana caranya supaya mengakses Web Statistik tsb (http://namadomainanda.com/stats) tanpa menggunakan Authentifikasi ?”

Cukup dengan mengedit file “index.php” yang berada di folder stats tadi. Anda cukup menghapus bagian :

if (!isset($PHP_AUTH_USER)) {

header(‘WWW-Authenticate: Basic realm=”Site Statistics”‘);
header(‘HTTP/1.0 401 Unauthorized’);
echo ‘Authorization Required.’;
exit;

} else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != $username) || ($PHP_AUTH_PW != $password)) {

header(‘WWW-Authenticate: Basic realm=”Site Statistics”‘);
header(‘HTTP/1.0 401 Unauthorized’);
echo ‘Authorization Required.’;
exit;
}
else {

sehingga hanya menjadi

<?php

require_once(“config.php”);

if($QUERY_STRING == “”){$query = “config=$site”;}else{$query=$QUERY_STRING;};

$Previous = false;
if(isset($_POST))
{
foreach($_POST as $key => $value)
{
if($Previous)
{
$POSTED .= “&”;
}

$POSTED = “$key=$value”;

$Previous = true;
}
}

$Curl = curl_init();
curl_setopt($Curl, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($Curl, CURLOPT_SSL_VERIFYHOST,0);
curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($Curl, CURLOPT_URL, “https://$site:2083/awstats.pl?$query”);
curl_setopt($Curl, CURLOPT_USERPWD, “$cpnlusername:$cpnlpassword”);
if(isset($_POST))
{
curl_setopt($Curl, CURLOPT_POST, TRUE);
curl_setopt($Curl, CURLOPT_POSTFIELDS, $POSTED);
}
curl_setopt($Curl, CURLOPT_RETURNTRANSFER, 1);
$results = curl_exec($Curl);
echo curl_error($Curl);
curl_close ($Curl);

for ($i = 0; $i < count($return_message_array); $i++) {
$results = $results.$return_message_array[$i];
}

if($query == “config=$site”){$results = str_replace(“src=\”", “src=\”?”, $results);}

if($framename==index){$results = str_replace(“src=\”", “src=\”index.php?”, $results);}

$results = str_replace(“action=\”", “action=\”index.php?”, $results);
$results = str_replace(“href=\”", “href=\”?”, $results);
$results = str_replace(“href=\”?http://”, “href=\”http://”, $results);
$results = str_replace(“awstats.pl?”, “”, $results);
$results = str_replace(“src=\”/images”, “src=\”images”, $results);

echo $results;

?>

Catatan :

Untuk lebih amannya sebaiknya file config.php diletakkan di folder /home/useranda/

setelah itu edit file index.php require_once(“config.php”); menjadi require_once(“/home/useranda/config.php”);

Herman Tarigan

Pernah menjadi Operator warnet, Customer Service Webhosting, System Administrator Webhosting, Website (SEO) Consultant, Operational Manager, Marketing dan sekarang memilih menjadi FREELANCE :)

Incoming search terms for the article:

cara mengatasi problem loading page, Bagaimana mengatasi problem loading page, mengatasi curl_setopt, mengatasi problem loading page, cara memperbaiki problem loading page
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • LinkedIn
  • Live
  • Print this article!
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

{ 5 comments… read them below or add one }

uwi March 15, 2007 at 4:00 am

ada kendala di curl_init() nya,
not find curl function
gmn cara mengatasi nya ya ??
thx

Reply

Perk1z March 26, 2007 at 3:03 am

Coba file configurasi ulang, silahkan download filenya di http://download.titik.org/awstat/Awstats_Access.zip
untuk file confignya diedit sehingga menjadi seperti http://download.titik.org/awstat/config.txt
lalu replace file index.php stats nya dengan http://download.titik.org/awstat/index.txt . Jangan lupa file config anda di letakkan diatas folder public_html (sebisa mungkin) untuk alasan security.

Reply

dank July 3, 2007 at 9:56 am

hallo…

saya coba kok yang nampil nge blank aja.. gk ada tulisan apa2…

tolong direview http://www.kopegtelrajawali.com

apa yang salah ya ?

Reply

Perk1z February 4, 2008 at 3:12 pm

ada kendala di curl_init() nya,
not find curl function
gmn cara mengatasi nya ya ??
thx

pastikan php anda fungsi curl nya di enable

Reply

Perk1z February 4, 2008 at 3:15 pm

saya coba kok yang nampil nge blank aja.. gk ada tulisan apa2…

tolong direview http://www.kopegtelrajawali.com

apa yang salah ya ?

Coba cek access log atau error log nya…. pesan errornya apa?

Reply

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word