Re: Limit FORM mailer submissions to 5 on website, then pause until reviewed by webmaster
- From: "Matt Garrish" <mgarrish@xxxxxxxxx>
- Date: 28 Sep 2006 18:22:56 -0700
Lance wrote:
Thank you Matt.
Your response and suggestions were amazing and well detailed. It's
given me a lot more to think about and definitely helped me to see the
bigger picture and protection problems.
Happy to help, but please quote context when you reply.
Although i may not get a large number of posts simultaneously, i will
need to think about either counting the current sessions or applying a
lock on a file, as the type of posts could mean that users spend 30
minutes writing the post before clicking submit. It sounds easier to
have a script that creates a temporary row in a sessions table as soon
as the Form Windows is opened. I would need to include a script just
before that to do a count on the session table. If the count is >= 5,
then don't display the input form and instead display the message,
otherwise show the form.
You wouldn't lock the file from the time they come to the page until
the time they submit. That would make your application impossible to
use. All I meant is that the file is locked while the transaction to
the database occurs (fraction of a second), so that no other attempts
to submit can happen while that one is in progress. The same can be
done by writing a proper transaction when you submit to your database
so that the table(s) are locked while that update occurs.
I think you have too much faith in the statefulness of web
applications, though. It's a bad idea to try and stop submissions when
you think you might have reached your limit. What if the person loads
the page and then goes away? What if they fill out some of the form and
go away? You'd then need a way to (somewhat arbitrarily) reap the
unused locks you've written to your database, which is an ugly
approach.
There's no nice way to do what you're after, other than to check your
count however you implement it both before displaying and before
accepting (don't forget a spammer who gets the source for your form can
bypass the first count). And that means that some people may get
rejected. It's just a fact of life if you're going to impose a limit
like you want.
So to avoid being flamed, could I ask if anyone could recommend a good
place to start and the best programming language to go with? I'll be
very grateful for any links and additional pointers.
Yes, Perl, but that's what you get for asking in a Perl newsgroup. I
doubt that you'll find anything prewritten, because these kinds of
multi-faceted applications tend to be use-specific, so there's no good
way to abstract them into something that anyone could plug in. If
you're looking to write it yourself, you might want to start at
learn.perl.org, otherwise you could look for someone to freelance at
jobs.perl.org.
Matt
.
- Prev by Date: FAQ 4.21 How do I remove consecutive pairs of characters?
- Next by Date: Perl 64 bit solaris - Strange Errors
- Previous by thread: FAQ 4.21 How do I remove consecutive pairs of characters?
- Next by thread: Perl 64 bit solaris - Strange Errors
- Index(es):
Relevant Pages
|