Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » help with a .txt hit counter using php
Closed Thread
Old 02-21-2006, 10:31 AM   #1 (permalink)
 
Newb Techie

Join Date: Feb 2006

Posts: 1

Citizen66

Default help with a .txt hit counter using php

I'm trying to get hit counters displayed on a page counting pages elsewhere using a .txt file and I can't get the code to work.

On the page being counted:

PHP Code:
<?php
$myFile 
"../../clicks/diana.txt";
$fp fopen($myFile'r+');
$theData fread($fpfilesize($myFile));
if(!
$theData){
    
$theData 0;
}else{
    
$theData++;
fseek($fp00);

}
fwrite($fp$theData);
fclose($fp);
?>
On the page showing the count:

PHP Code:
<?php    
$myFile 
"./clicks/diana.txt";
$fp fopen($myFile'r');
$theData fread($fpfilesize($myFile));
fclose($fp);

echo 
$theData;
?>
Any ideas where I'm going wrong?
Citizen66 is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On