# Page counter problem!

**URL:** https://forum.kirupa.com/t/page-counter-problem/114404
**Category:** Uncategorized
**Created:** [June 28, 2004, 9:48am UTC](https://forum.kirupa.com/t/page-counter-problem/114404 "2004-06-28T09:48:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![xyron](https://avatars.discourse-cdn.com/v4/letter/x/f17d59/32.png) [@xyron](https://forum.kirupa.com/u/xyron)
#### Post date: [June 28, 2004, 9:48am UTC](https://forum.kirupa.com/t/page-counter-problem/114404/1 "2004-06-28T09:48:31Z")

</div>

Hello all!

I have followed the tutorial on creating a live page counter in flash and somehow run into a problem to which i don’t seem to be finding the solution. Perhaps someone here might be able to offer his/her generous help in solving this issue.

**Problem:**

The page counter works just fine the first time i load the page. After doing a refresh using the Ctrl & F5 key or just by clicking on the refresh button in my browser the count keeps going up (which as far as i understood from the tutorial is not supposed to happen).

When i do the same kind of refresh on the tutorial page the count stays unchanged though!

I also downloaded the finished fla file but for some reason or other flash MX doesn’t let me open it, giving me the error: “unexpected file format”.

**Here is my code of the php file that i wrote for the counter.**

\<?php  
$file = fopen(“count.txt”, “r”);  
$count = fread($file, 10240);  
fclose($file);  
$count = explode("=", $count);  
$count[1] = $count[1]+1;  
$file = fopen(“count.txt”, “w+”);  
fwrite($file, “count=”.$count[1]);  
fclose($file);  
print “count=”.$count[1];  
?\>

I am using PHP Version 4.2.2 running as an apache module on a redhat 9 linux box.

Hope that someone can help me here.

Thanx in advance for taking the time to read my post!

Mike. :hr:
