The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
PS, I'll show you why this afternoon sometime!
> 'w' - Open for writing only; place the file pointer at the beginning
> of the file and truncate the file to zero length. If the file does not
> exist, attempt to create it.
Freeola doesn't seem to allow files to be created like this.
I used a small user online script, on Lycos it created the text log file but on Freeola it just produced an error. I had to create the text file by uploading a blank file and renaming it.
'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
Also, you do need to be careful with counters, if your site is at all busy, in case two clients are using the file at the same time - its all too easy for one to be updating the file just as the second is reading it, and then you get odd results to say the least, or the counter can revert to zero. I had code almost the same as yours, and kept finding that the file had been reset or corrupted.
Eventually I found that the best way is to have two files - the counter file itself, and another "lock" file. The process is:
Open the "lock" file and attempt to lock it
If you succeed, only then open the counter file, increment and update it
Then close both files
Sure, it means that if a second client arrives at the same time as someone is updating the counter, then they skip the update and you miss a count, but I got tired of having to deal with corrupted files before I used this locking.
I think it's nice.
Cheers Turbo!
I think (and this is a stab in the dark) if you 666 the folder, all subsequent files created in there will have 666 properties.
Cheers TN!
> Looks like the last three lines of the code - is that "w+"
> meant to be there?
The code is fine, it's lifted from my website.