Jump to content

Archived

This topic is now archived and is closed to further replies.

pixeltrace

help on hit counter

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[quote author=pixeltrace link=topic=86816.msg349362#msg349362 date=1140897524]
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.
[/quote]

Your website does'nt exist.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.