[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple solution to voting problem?
Robert Myers wrote:
> I has suggested a temp table, that could be nuked as well.
Just using the log file would use less resources, I *think*.
> if($aid>-1) {
> my $cursor = $dbh->prepare("
> SELECT id from pollvoters where
> qid='$qid' AND
> id='$ENV{REMOTE_ADDR}'");
> $cursor->execute;
>
> # print $ENV{REMOTE_ADDR};
>
> if ($cursor->fetchrow()) {
> $notes="You have already voted.";
> } else {
> $notes="Your vote has been registered.";
> $dbh->do("
> INSERT into pollvoters
> (qid,id,time)
> VALUES('$qid','$ENV{REMOTE_ADDR}',
> now())");
>
> What do you make of that? qid and aid are for tracking the question.
Looks like it's not even allowing the possibility of two votes for the
same IP. Maybe this is acceptable, but as I pointed out earlier, it
will leave some people out in the cold.
I guess this isn't a super-critical issue in any case. If we keep the
log files we can write a script later to do what needs to be done.