[PHP] voting using text files

2002-05-22 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Are there any inherent problems I need be aware of for

Re: [PHP] voting using text files

2002-05-22 Thread 1LT John W. Holmes
02 9:38 AM Subject: [PHP] voting using text files > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > hi all > I have to build a php 'survey' app. but cannot use a db, > clearly text files are the way but I wondered, before I start if any of > you have done similar

Re: [PHP] voting using text files

2002-05-22 Thread Justin French
Just have a look around for a counter script which uses file locking, then port it to suit your needs, or check out the flock() example that *i think* there is in the manual. phpbuilder.com or zend.com or the rest are bound to have a script. Justin French on 22/05/02 11:38 PM, Nick Wilson ([

Re: [PHP] voting using text files

2002-05-22 Thread Jason Soza
e3, inside each one, store their vote choice, their IP, and a timestamp. I don't know, I'm not an expert! Just throwing out ideas. Jason Soza - Original Message - From: "1LT John W. Holmes" <[EMAIL PROTECTED]> Date: Wednesday, May 22, 2002 5:46 am Subject: Re:

Re: [PHP] voting using text files

2002-05-22 Thread Analysis & Solutions
Nick: > I have to build a php 'survey' app. but cannot use a db, > clearly text files are the way but I wondered, before I start if any of > you have done similar and might offer any words of wisdom? Everyone thus far has recommended file locking. Another way is to create a new file for each

Re: [PHP] voting using text files

2002-05-22 Thread Miguel Cruz
On Wed, 22 May 2002, Jason Soza wrote: > Using file locking, if two people tried to use the script at the same > time, wouldn't there be an error for one of them? The second session would just have to wait for the first to finish (which should be an infinitessimal amount of time). > My first g

Re: [PHP] voting using text files

2002-05-22 Thread 1LT John W. Holmes
> A good structure would be to have one file for each possible answer and each > file contains the number of votes it has recieved. > Then: > --> Open file for the chosen option as read only > --> Read the value in the file > --> Close the file > --> Increase the value by one using ++ > --> Open t

Re: [PHP] voting using text files

2002-05-22 Thread Rasmus Lerdorf
I think you guys are making this way more complicated than it needs to be. Anytime you start talking about locking files, you need to apply a huge reality check to yourself and sit down and approach the problem from a different direction. In this case could I suggest that you make use of the fact

Re: [PHP] voting using text files

2002-05-22 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Rasmus Lerdorf declared > I think you guys are making this way more complicated than it needs to be. > > In this case could I suggest that you make use of the fact that appends of > less than a blocksize are atomic. Therefore, why no

Re: [PHP] voting using text files

2002-05-22 Thread Jason Soza
AIL PROTECTED]> Date: Wednesday, May 22, 2002 9:45 am Subject: Re: [PHP] voting using text files > On Wed, 22 May 2002, Jason Soza wrote: > > Using file locking, if two people tried to use the script at the > same > > time, wouldn't there be an error for one of them? &g

RE: [PHP] voting using text files

2002-05-22 Thread Scott Hurring
; To: Miguel Cruz > Cc: PHP-General > Subject: Re: [PHP] voting using text files > > > And this is why I'm not an expert! > > I have a counter script on my page now that uses a flatfile to store > IP's, but it also stores a timestamp. When someone visits th

Re: [PHP] voting using text files

2002-05-22 Thread Peter
Well done that man! "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think you guys are making this way more complicated than it needs to be. > Anytime you start talking about locking files, you need to apply a huge > reality check to yoursel

RE: [PHP] voting using text files

2002-05-22 Thread Vail, Warren
sday, May 22, 2002 11:19 AM To: 1LT John W. Holmes Cc: Jason Soza; PHP-General Subject: Re: [PHP] voting using text files I think you guys are making this way more complicated than it needs to be. Anytime you start talking about locking files, you need to apply a huge reality check to yourself and

RE: [PHP] voting using text files

2002-05-22 Thread Scott Hurring
dorf'; 1LT John W. Holmes > Cc: Jason Soza; PHP-General > Subject: RE: [PHP] voting using text files > > > I see some real genious in this solution. This would be a > great function > addition to PHP, anybody? > > Warren Vail > Tools, Metrics & Quality Process

RE: [PHP] voting using text files

2002-05-22 Thread Vail, Warren
) 774-9891 215 Fremont 02-658 -Original Message- From: Scott Hurring [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 12:47 PM To: Php-General (E-mail) Subject: RE: [PHP] voting using text files file_append($file, $text); ?? --- Scott Hurring Systems Programmer EAC Corporation [E