Jump to content

help on hit counter


pixeltrace

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!
Link to comment
https://forums.phpfreaks.com/topic/3597-help-on-hit-counter/
Share on other sites

  • 2 years later...
[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.
Link to comment
https://forums.phpfreaks.com/topic/3597-help-on-hit-counter/#findComment-545750
Share on other sites

Archived

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

×
×
  • Create New...

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.