Re: [PHP] Re: Problem: Writing into Files?
Hi > The thing with this method is that it's just like the previous one; it opens > then adds something. I'm assuming if again two visitors visit at the same > time, this'd reset to zero. No, the "a" mode (IIRC) handles file locking for you. Even if it doesn't, the file won't be truncated, so you won't lose your count. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 25th July) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Problem: Writing into Files?
> I don't quite know how I can write a bite into a file. I also looked into a > manual and couldn't find a mention of FLock-ing in the explaination for > FOpen parameters. Ok, from memory: The 1 could be any single byte character I guess. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 25th July) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Problem: Writing into Files?
Dear Richard, I don't quite know how I can write a bite into a file. I also looked into a manual and couldn't find a mention of FLock-ing in the explaination for FOpen parameters. Thanks a lot for your help. -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com email: parham90 at GMail dot com "Richard Heyes" wrote in message news:af8726440908020221r22e1efb3g321ba4140bfa4...@mail.gmail.com... > Hi, > >> ... > > You can write a single byte to the file to "increment" the counter, > then to read the count just use filesize(). I believe the a fopen() > mode will handle locking for you. It will result in a slowly growing > file, but space isn't exactly at a premium nowadays, and when the file > gets to a certain size (eg 1 gazillion k) you could use a summary > file. > > -- > Richard Heyes > HTML5 graphing: RGraph - www.rgraph.net (updated 25th July) > Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Problem: Writing into Files?
Hi, > ... You can write a single byte to the file to "increment" the counter, then to read the count just use filesize(). I believe the a fopen() mode will handle locking for you. It will result in a slowly growing file, but space isn't exactly at a premium nowadays, and when the file gets to a certain size (eg 1 gazillion k) you could use a summary file. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 25th July) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php