1
iicky
Hit Counter
  • 2006/2/24 16:30

  • iicky

  • Just popping in

  • Posts: 3

  • Since: 2006/2/24


Isn't there just a simple little hit counter you can place on your page, instead of all this stats stuff. Just a simple little counter would do. I can't seem to find one anywhere... Anyone?

2
luciano
Re: Hit Counter
  • 2006/2/24 17:09

  • luciano

  • Quite a regular

  • Posts: 261

  • Since: 2003/11/3


<?php

$file 
"counter.txt";
$user_ip $_SERVER['REMOTE_ADDR'] . "n";
$ip_list file($file);
$visitors count($ip_list) - 1;

if (
in_array($user_ip$ip_list))
    {
    echo (
"$visitors");
    } else {
    
    
$fp fopen($file,"a");
    
fwrite($fp"n$user_ip");
    
fclose($fp);
    
    
$visitors++;
    echo 
$visitors;
    }

?>



upload this script and a .txt file with on the first line some text (just put the name of your site there), chmod the textfile 777 and that should do the job. It stores the ip's in the txt file.

I used it om www.dehaarspecialist.be (bottom right).

I know, it's not perfect but it does the job

Code credits: ??????????

3
zyspec
Re: Hit Counter
  • 2006/2/24 17:09

  • zyspec

  • Module Developer

  • Posts: 1093

  • Since: 2004/9/21


I don't recall seeing a simple counter module anywhere.

What most people that just want a page load counter have done is to just put a script into a custom block. There's several GPL scripts available that will create a counter that will display the number of times the page (or block in this case) has been loaded.

4
barryc
Re: Hit Counter
  • 2006/2/24 17:11

  • barryc

  • Just can't stay away

  • Posts: 480

  • Since: 2004/3/20


I have used a simple cgi script to put a counter on a page or in a block. You can get the one I used at http://perlwebsite.com/hitcounter.htm

Put the cgi script in your cgi-bin

Then on the page where you want to call it, put:

<script language="JavaScript" src="http://aka.org/cgi-bin/counter.cgi"></script> visitors etc., etc.

changing the text to suit your site. You can also call it from a custom block.

A little more elaborate is php-stats available at http://www.phpstats.net. There is a FAQ for installing it at https://xoops.org/modules/smartfaq/faq.php?faqid=529
Barry Cooper
Sweet Home, Oregon

5
iicky
Re: Hit Counter
  • 2006/2/24 20:08

  • iicky

  • Just popping in

  • Posts: 3

  • Since: 2006/2/24


Thanks everyone for a reply. Luciano, where exactly do you upload it to? in the root webserver directory right? Do i need to create a module or block for it too? Do i need to add any include statements anywhere in any of my other scripts?

6
brmecham
Re: Hit Counter
  • 2007/5/4 8:12

  • brmecham

  • Just popping in

  • Posts: 35

  • Since: 2004/7/13


luciano, I am not exactly sure how to add this counter to my site, I created a counter.txt and a counter.php (with the php code you provided) and put those on my site. I want them to show up in the footer as yours does, the only way I know how is to add that to THEME.HTML, but that doesn't quite work - i tried it with a statement such as this:

<?php include ("counter.php"); ?>


it didn't work for me. not sure what else to try.

Login

Username:
Password:

Lost Password? Register now!

Who's Online

65 user(s) are online (40 user(s) are browsing Support Forums)


Members: 0


Guests: 65


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jan 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits