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?
My first guess at defeating this is having the script write a file
named after the voter's IP. Have the file written to a different
directory for whatever choices they have, then use readdir() to count
the files in each directory, i.e. the number of votes for each choice.
Then if that same IP tries to vote again, check it against votes
already received and approve/deny it.
I guess another way, have files written with consecutive titles, vote1,
vote2, vote3, inside each one, store their vote choice, their IP, and a
I don't know, I'm not an expert! Just throwing out ideas.
----- Original Message -----
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
Date: Wednesday, May 22, 2002 5:46 am
Subject: Re: [PHP] voting using text files
> Use file locking, so only one instance of the script is writing to
> the file
> at a time...
> ---John Holmes...
> ----- Original Message -----
> From: "Nick Wilson" <[EMAIL PROTECTED]>
> To: "php-general" <[EMAIL PROTECTED]>
> Sent: Wednesday, May 22, 2002 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 and might offer any words of wisdom?
> > Are there any inherent problems I need be aware of for example
> (I can
> > already think of one: what if 2 people try to vote at the same
> > Just some general thoughts would be greatly appreciated ;)
> > - --
> > Nick Wilson // www.explodingnet.com
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php