Re: Can a script run twice?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-05-23 at 16:47, tedd wrote:
>
> Considering that everyone is putting in their $0.02, here's my suggestion.
> 
> 1. Keep the form and processing on one page. The number of pages is 
> not the problem -- double clicking is.
> 
> 2. Start a session.
> 
> 3. Initialize a variable that is incremented each time the page is 
> refreshed per session.
> 
> 4. If the variable's value is larger than one, then do something 
> other than create and insert a duplicate record. Allow the user one 
> insert per session or whatever.

I'd stay away form relying on the session unless your whole site relies
on the session. Your form should contain a hidden submission UID and
THAT should be used to determine if the form was submitted already. In
this way your form will still detect double submissions even when
sessions are disabled. Then the user needs to work quite hard to do a
double submission -- if you're using the POST method anyways :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux