Jump to content


Photo

help on hit counter


  • Please log in to reply
2 replies to this topic

#1 pixeltrace

pixeltrace
  • Members
  • PipPipPip
  • Advanced Member
  • 577 posts

Posted 25 February 2006 - 07:58 PM

guys,

i need help on this.
kindly check
[a href=\"http://www.sinagtala.net/sinag3\" target=\"_blank\"]http://www.sinagtala.net/sinag3[/a]
notice the hit counter on the upper right corner
whenever i go to the other page it adds up again.
what i wanted to happen is that it will just hit on the index page
and not on the subpages anymore
this is my script for the index page and the other subpages.

========= this is the script that i placed on the first 3 lines of each page
<?php
session_start();
?>
=========
========= i just include the counter.php on every page
<? include 'counter.php'; ?>
=========
========= this is the script that's in the counter.php
<?php

$counter_file = ("counter.txt");
$visits = file($counter_file);

if(!session_is_registered(session_id()))

{
$visits[0]++;
}

$fp = fopen($counter_file , "w");

fputs($fp , "$visits[0]");


fclose($fp);

echo "$visits[0]";

session_register(session_id());
?>
==============

hope you guys can help me with this.

thanks!


#2 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 26 February 2006 - 03:09 AM

make another file with all that code, but leave out the:

fputs($fp , "$visits[0]");

and on all the pages you dont want it to count on, include that file instead
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#3 paulman888888

paulman888888
  • Members
  • PipPipPip
  • Advanced Member
  • 332 posts
  • LocationEngland

Posted 20 May 2008 - 03:11 PM

guys,

i need help on this.
kindly check
[a href=\"http://www.sinagtala.net/sinag3\" target=\"_blank\"]http://www.sinagtala.net/sinag3[/a]
notice the hit counter on the upper right corner
whenever i go to the other page it adds up again.
what i wanted to happen is that it will just hit on the index page
and not on the subpages anymore
this is my script for the index page and the other subpages.


Your website does'nt exist.
I Say One Thing & That Is!
BE HAPPY




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users