Re: Refresh-avoidance
| From: | Matthew Leverton | Date: | Tue, 27 Jun 2000 19:23:45 +0000 |
| Subject: | Re: Refresh-avoidance | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3416@lists.php.net to get a copy of this message | ||
I like implementing that sort of thing on the database itself. In
databases like MSSQL 7, you can create insert triggers. I then check
to make sure no duplicate data is being entered (usually for a
certain time period or for a single ip).
If you are using a database without many features (mysql), then it
should be just as easy (although maybe a bit more tedious) to
implement this check into your code. Basically, before every INSERT,
you could first do a SELECT to see if the same data exists. There are
many different ways to do it (such as even setting a cookie or session
variable that flags that the user has already updated), so you can
choose whatever works best in your case.
There is no way to prevent a user from hitting refresh. That is
exactly what the refresh is supposed to do... resubmit the page.
You may as well take care of the root of the problem instead of
trying to avoid it. :)
--
Matthew Leverton - matthew@aeroinc.net -
http://www.allegro.cc
-----Original Message-----
From: David VanHorn <dvanhorn@cedar.net>
To: php-general@lists.php.net <php-general@lists.php.net>
Date: Tuesday, June 27, 2000 2:11 PM
Subject: [PHP] Refresh-avoidance
>
>I have a form issue that's bugging me.
>As a part of a user signup, there is a page with a form.
>The user fills out the form and submits, and all is well, and he gets a
>confirmation screen, but if he refreshes the confirmation screen (this page
>contains the script that does the signup work) then a duplicate account is
>created.
>
>I know I can scan for dupes and abort, but is there a simpler way to avoid
>this?
>(Like a "refresh-killer"?)
>
>TIA
>--
>
>www.SpamWhack.com A pre-emptive strike against spam
>A tornado is a lady whose skirts you do NOT want to look up!
>Where's dave?
>http://www.findu.com/cgi-bin/find.cgi?kc6ete-9
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>