cyberwolf14
Programmer
Hello,
I have problems with my self-made counter sometimes it resets all by itselfs this is the code
<?
function viewfile($filename){
$fd = fopen ($filename, "r"
;
return fread ($fd, filesize ($filename));
fclose ($fd);
}
function writefile($filename,$contents){
$fd = fopen($filename, "w+"
;
fwrite($fd , $contents);
fclose($fd);
}
writefile("bancount.txt",viewfile("bancount.txt"
+1);
$ll = viewfile("bancount2.txt"
. "\n" . viewfile("bancount.txt"
;
writefile("bancount2.txt",$ll);
echo viewfile("bancount.txt"
;
?>
What did I do wrong, can you help me ????
I have problems with my self-made counter sometimes it resets all by itselfs this is the code
<?
function viewfile($filename){
$fd = fopen ($filename, "r"
return fread ($fd, filesize ($filename));
fclose ($fd);
}
function writefile($filename,$contents){
$fd = fopen($filename, "w+"
fwrite($fd , $contents);
fclose($fd);
}
writefile("bancount.txt",viewfile("bancount.txt"
$ll = viewfile("bancount2.txt"
writefile("bancount2.txt",$ll);
echo viewfile("bancount.txt"
?>
What did I do wrong, can you help me ????