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

Pages: (2): « First [ 1 ] 2 » Last »
Using Awstats to make a hitcounter
Author: Message:
user27089
Disabled Account


Posts: 6321
Joined: Nov 2003
Status: Away
O.P. Huh?  Using Awstats to make a hitcounter
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 :).
05-22-2005 08:16 PM
Profile PM Find Quote Report
saralk
Veteran Member
*****

Avatar

Posts: 2598
Reputation: 38
35 / Male / Flag
Joined: Feb 2003
RE: Using Awstats to make a hitcounter
if your using php...

code:
<?php
$file = fopen("counter.txt", "r+");
$file++;
fwrite("counter.txt", $file);
echo $file;
?>


I haven't tested it out, but it should work.
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
05-22-2005 08:23 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Using Awstats to make a hitcounter
I'm no PHP person, but wouldn't you have a problem with '$file++;'?
[Image: spartaafk.png]
05-22-2005 08:32 PM
Profile PM Web Find Quote Report
saralk
Veteran Member
*****

Avatar

Posts: 2598
Reputation: 38
35 / Male / Flag
Joined: Feb 2003
RE: Using Awstats to make a hitcounter
that makes the number increase by one.

and $file-- make it, yes you guessed it, decrease by 1 :banana:
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
05-22-2005 08:33 PM
Profile PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Using Awstats to make a hitcounter
Looks more to me like (Increase file pointer by 1', or have I just too much C++?
[Image: spartaafk.png]
05-22-2005 08:36 PM
Profile PM Web Find Quote Report
saralk
Veteran Member
*****

Avatar

Posts: 2598
Reputation: 38
35 / Male / Flag
Joined: Feb 2003
RE: Using Awstats to make a hitcounter
im not sure, i did that pretty quickly, i can't remember if $file = fread() will put the file contents in the var, or make it some sort of identification var. WDZ WDZ WDZ where for art thou?
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
05-22-2005 08:38 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Using Awstats to make a hitcounter
nah you need to do stuff in this order

fopen with r parameter to read it
fread it
store in a variable
fclose
fopen again with w parameter to clear it and prepare it for writing
add 1 to the variable
fwrite
and then echo it

code:
<?
$counter = fopen("counter.txt", "r");
$blah = fread($counter, filesize("counter.txt"));
fclose($counter);
$counter = fopen("counter.txt", "w");
$blah = $blah + 1; //not sure if $blah++ would work, try it
fwrite($counter, $blah);
fclose($counter);
echo $blah;
?>


This post was edited on 05-22-2005 at 08:41 PM by Eljay.
05-22-2005 08:39 PM
Profile PM Find Quote Report
Veggie
Full Member
***

Avatar

Posts: 415
Reputation: 21
37 / Male / Flag
Joined: Sep 2004
RE: Using Awstats to make a hitcounter
$blah++;
would work, it simply adds one.
05-22-2005 08:53 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Using Awstats to make a hitcounter
LJ's code looks more correct to me.
You gotta remember though, I don't know any PHP.
[Image: spartaafk.png]
05-23-2005 08:33 AM
Profile PM Web Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: Using Awstats to make a hitcounter
quote:
Originally posted by Veggie
$blah++;
would work, it simply adds one.

yeh but what if the txt file contains like "1000 hits" ?

it wouldnt change to 1001 because its not all integers

EDIT: actually in this case mine wouldnt work :-o

This post was edited on 05-23-2005 at 08:36 AM by Eljay.
05-23-2005 08:36 AM
Profile PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


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