Jump to content

PHP counter

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
fimmy

fimmy

    Newbie

  • Members
  • Pip
  • 3 posts
Pls could some1 tell me what wrong with this code

Thanks
	<?php
	
      echo '<div id="date">' . date("d/m/Y") . '</div>';
$filename= "counterlog2.txt" ;
$fd = fopen ($filename , "r") or die ("Can't open $filename") ;
$fstring = fread ($fd , filesize ($filename)) ;
echo '<div id="counter">Visits: ' . "$fstring" . '</div>';
fclose($fd) ;

$fd = fopen ($filename , "w") or die ("Can't open $filename") ;
$fcounted = $fstring + 1 ;
$fout= fwrite ($fd , $fcounted ) ;
fclose($fd) ;
  ?>

Edited by John, 21 April 2008 - 09:32 AM.


#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
http://forum.codecal...le-counter.html

#3
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Well that solved it quickly...
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#4
fimmy

fimmy

    Newbie

  • Members
  • Pip
  • 3 posts
Thanks so much was very helpfull

#5
ggggqqqqihc

ggggqqqqihc

    Newbie

  • Members
  • PipPip
  • 10 posts
There is a problem when many users visit this page at the same time. The simple method is using database.

#6
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Yes, but that's not as simple.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums