What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Using Awstats to make a hitcounter

Using Awstats to make a hitcounter
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: Using Awstats to make a hitcounter
quote:
Originally posted by traxor
Does anybody know how I can use Awstats to make a hit counter, I want it a text hit counter on my site, showing the "Hits" that I have received.

Not unique :).
=/ why are you all making normal file based ones insted of ones that fetch their data from "awstats"




quote:
Originally posted by Stigmata
<?PHP
    $file="hitscount.dat";
    $handle=fopen($file, "r+");
    $hits=fread($handle,filesize("$file"));
    $hits+=1;
    fclose($handle);
    $handle=fopen($file, "w");
    fwrite($handle, $hits);
    fclose($handle);
?>

=/ why do you use r+ if your just going to read from it , you should just use r then open the file with w place your data and close it. OR use w+  read from the file then write to it and close the file like so...

code:
<?php
    $file="hitscount.dat";
    $handle=fopen($file, "w+");
    $hits=fread($handle,filesize("$file"));
    $hits++;
    fwrite($handle, $hits);
    fclose($handle);
?>


Really not the best code because of no error checking but eh...

This post was edited on 05-23-2005 at 01:22 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
05-23-2005 01:20 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Using Awstats to make a hitcounter - by user27089 on 05-22-2005 at 08:16 PM
RE: Using Awstats to make a hitcounter - by saralk on 05-22-2005 at 08:23 PM
RE: Using Awstats to make a hitcounter - by RaceProUK on 05-22-2005 at 08:32 PM
RE: Using Awstats to make a hitcounter - by saralk on 05-22-2005 at 08:33 PM
RE: Using Awstats to make a hitcounter - by RaceProUK on 05-22-2005 at 08:36 PM
RE: Using Awstats to make a hitcounter - by saralk on 05-22-2005 at 08:38 PM
RE: Using Awstats to make a hitcounter - by Eljay on 05-22-2005 at 08:39 PM
RE: Using Awstats to make a hitcounter - by Veggie on 05-22-2005 at 08:53 PM
RE: Using Awstats to make a hitcounter - by RaceProUK on 05-23-2005 at 08:33 AM
RE: Using Awstats to make a hitcounter - by Eljay on 05-23-2005 at 08:36 AM
RE: Using Awstats to make a hitcounter - by Stigmata on 05-23-2005 at 08:52 AM
RE: Using Awstats to make a hitcounter - by -dt- on 05-23-2005 at 01:20 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On