Torna indietro   Serverplan Forum > Hosting > Pannello di controllo Cpanel - Linux

Rispondi
 
LinkBack Strumenti discussione Modalità visualizzazione
  #1 (permalink)  
Vecchio 20-05-2005, 09.30.17
Administrator
Amministratore
 
Data registrazione: 11-09-2002
Messaggi: 3,407
serverplan ha disabilitato la reputazione
Predefinito Visualizzare AWStats senza accedere in Cpanel

Questo script permette di accedere alla visualizzazione delle statistiche prodotte da AWStats senza accedere a cPanel dopo averlo adeguatamente configurato inserendo username, password e nome del dominio.

Codice:
<?php
/*
dv at josheli.com

Proxy for viewing Awstats outside of cpanel. I assume no liability.


1 out of 3 people ask me if it's "safe" to have their username and password
in this file. Here's my answer:

When you signed up with your web hosting provider, they probably provided
you with an email with your login/password, right? Do you ever use FTP
with your site? Do you login to your mail server, to hotmail, to yahoo, to
anywhere else? When you log in to cpanel or WHM, do you do it through SSL
or not? Have you installed any other web software like osCommerce or phpBB
or any other script?

In all cases, your user/password is either sent through dozens of
computers in plain text and is sitting in someone else's harddrive or
database, or is stored in plain text on some file on your webserver. You
are never safe.

So, if someone wants to steal ANY user/password, it's pretty easy. In
fact, probably half a dozen people could look at any password of yours
right now. But to answer what i think you're specifically asking about about
this script, no, not just anyone can find out the user/pass.

And besides that, there are other precautions you could take. Ask around.
*/

$user = 'username';//your cpanel username
$pass = 'password';//your cpanel password
$domain = 'mydomain.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 = false;
$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($dynamic_images && $requesting_image) //it's a .png file...
{
  if(!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;
?>
Rispondi citando
  #2 (permalink)  
Vecchio 29-05-2006, 18.02.32
Junior Member
 
Data registrazione: 29-05-2006
Messaggi: 1
SviluppoWeb.net is on a distinguished road
Predefinito

Non vedo le immagini cosa devo modificare?
Rispondi citando
  #3 (permalink)  
Vecchio 13-06-2006, 11.48.08
Junior Member
 
Data registrazione: 02-03-2006
Messaggi: 1
catgrie is on a distinguished road
Predefinito

Ciao, se non hai ancora risolto prova cos?

$user = 'username';//your cpanel username
$pass = 'password';//your cpanel password
$domain = 'mydomain.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;
?>
Rispondi citando
  #4 (permalink)  
Vecchio 14-12-2006, 11.19.55
Junior Member
 
Data registrazione: 04-07-2005
Messaggi: 14
domsaggese is on a distinguished road
Predefinito

non ho capito... quest'ultimo script va aggiunto al primo? prima o dopo i pasti? :shock:

grazie...
Rispondi citando
  #5 (permalink)  
Vecchio 27-01-2007, 17.38.38
Junior Member
 
Data registrazione: 07-07-2006
Residenza: wisconsin
Messaggi: 8
glosstar is on a distinguished road
Predefinito Awstats direttamente da web senza passare da cpnel

Lo script sopra descritto non visualizza le immagini in quanto esse sono assenti. A completamento di quanto descritto nei precedenti posts quanto segue per riuscire a vedere le IMMAGINI in AWSTATS.

1. Scaricare le immagini di awstats presso il sito
http://www.visitmetroatlanta.com/webstats/images.zip
2. Rinominare awstats_images la cartella images appena scaricata
3. Dopo averlo opportunamente modificato, denominare index.php lo script in cima alla pagina (file reperibile a josheli.com)
4. Creare una cartella denominata awstats e inserirvi il file php al punto 3 e la cartella immagini al punto 2
5. Fare upload della cartella awstats in public_html sul vostro server
6. Aprire browser e inserire http://www.miodominio.com/awstats

Un saluto a tutti Gianni Losi
Rispondi citando
  #6 (permalink)  
Vecchio 03-09-2008, 22.29.18
Junior Member
 
Data registrazione: 03-09-2008
Messaggi: 2
kreatyve is on a distinguished road
Unhappy

Ho fatto il procedimento descritto ma a me non funziona...

http://www.brianzaarreda.it/awstats

Nemmeno copiando in root il file con il code in cima al post
http://www.brianzaarreda.it/stats.php

Cosa suggerite?
Grazie
Rispondi citando
Rispondi

Strumenti discussione
Modalità visualizzazione

Regole di scrittura
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Attivato
Le faccine sono Attivato
Il codice [IMG] è Attivato
Il codice HTML è Disattivato
Trackbacks are Attivato
Pingbacks are Attivato
Refbacks are Attivato


Discussioni simili
Discussione Autore discussione Forum Risposte Ultimo messaggio
webmail senza cpanel domsaggese Pannello di controllo Cpanel - Linux 3 12-11-2007 10.08.31
Accedere a cPanel/WHM/webmail dalla porta 80 serverplan Pannello di controllo Cpanel - Linux 4 27-04-2007 08.55.59
Visualizzare Webalizer senza accedere in Cpanel serverplan Pannello di controllo Cpanel - Linux 3 19-12-2005 15.13.20
non visualizzare temporaneamente un sito frhell HTML 1 23-10-2005 21.33.26
Form HTML per accedere a cPanel serverplan Pannello di controllo Cpanel - Linux 3 26-08-2005 11.11.08


Tutti gli orari sono GMT +1. Adesso sono le 08.05.36.


Powered by vBulletin versione 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0
Traduzione italiana : www.vbulletin.it