[SOLVED] Counter Problem...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

[SOLVED] Counter Problem...

Post by Dale »

Nice New Style :D

I'm using a counter off a site, which had it as a tutorial. Im sorry but i cannot rmember where i got it from however when i place it on a page it counts two hits instead of just one hit.

Code: Select all

<?php
echo "<center><font face="verdana" size="1">";

$counthandle=fopen("sample.php","r");
$getcurrent=fread($counthandle,filesize("sample.php")); 
$getcurrent=$getcurrent+1; 

fclose($counthandle);
$counthandle1=fopen("sample.php","w");
fputs($counthandle1,$getcurrent);

fclose($counthandle1);
$counthandle2=fopen("sample.php","r");
$getrecent=fread($counthandle2,filesize("sample.php"));

print "$getrecent";

fclose($counthandle2);
echo "</center></font>";
?>
tags dont work :(

Could someone tell me where im going wrong.
Last edited by Dale on Tue Jan 11, 2005 6:03 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Two questions..

1. Is there a broken image on the page anywhere?

2. Are you using Firefox?

If thats a possible combination then I reckon that'll be the issue. If you have an image without a src then FF requests the calling page again. At least, it does on one of my sites..
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Ahhh, yes i have broken images on there, well images that dont link anywhere (eg; src="." ) because I havent had the images sent to me yet... i'll give it a test without the images to see if it works.

[EDIT]
THANKS! That was the problem, it was caused by the broken images.
Post Reply