This is a discussion on PHP script for a AWstats based counter within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I'm an italian guy and i'm a basic PHP coders. This is the counter: http://www.kensan.it/...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm an italian guy and i'm a basic PHP coders.
This is the counter: http://www.kensan.it/extra/stats/stats.phps store it in public_html/extra/stats/stats.php put in your cron: wget --output-document=public_html/extra/stats/cron.html http://www.kensan.it/extra/stats/stats.php that start stats.php every day and make a file impression.txt in public_html/extra/stats/ impression.txt is used for the counter. Use this php code in your article page for displaying the total readers of the article. <?php //Numero di letture di questo articolo tratte da awstats $stats_dir = "/home/kensan/public_html/extra/stats"; $file_impressions = "impressions.txt"; $filename= $stats_dir . "/" . $file_impressions; if (is_readable($filename)) { $vet_art_impression = file($filename); $nome_this = basename($_SERVER['PHP_SELF'], ".php"); $impressions=0; foreach($vet_art_impression as $val){ $vet = explode(" ",$val); if($vet[0] == $nome_this){ $impressions=$vet[1]; } } if ($impressions != 0){ echo "readers: <b>$impressions<b>" ; } } ?> sorry for my english. change kensan with your site. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|