php-general Digest 25 Aug 2011 09:02:15 -0000 Issue 7454

Topics (messages 314595 through 314602):

Re: Dealing with multiple form submissions
        314595 by: John Black
        314598 by: Mike Mackintosh
        314599 by: Ashley Sheridan
        314600 by: tamouse mailing lists
        314601 by: Chris Stinemetz
        314602 by: John Black

Re: PhpMyAdmin in EasyPHP cannot run DROP DATABASE
        314596 by: Nam Gi VU
        314597 by: Bastien Koert

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 08/24/2011 03:04 AM, Jason Pruim wrote:
Wondering what everyone does to prevent multiple form submissions?
My form is simply getting emailed to my email, and it redirects to a success 
page when submitted...
Would it be as simple as doing something with the cache control? Basically I'm 
trying to avoid someone submitting a form... Then hitting back, and submitting 
again, then hitting back.... I think you get the idea...
What do you all do?
Jason Pruim


Hi,
I am using $_SESSION for this. Set a value on the initial page, a timestamp is a good choice, then validate the value on the receiving script and clear the value.

I like to use a timestamp because it will allow you to deny a comment which took too long to submit.
--- End Message ---
--- Begin Message ---

On Aug 24, 2011, at 11:52, John Black <s...@network-technologies.org> wrote:

> On 08/24/2011 03:04 AM, Jason Pruim wrote:
>> Wondering what everyone does to prevent multiple form submissions?
>> My form is simply getting emailed to my email, and it redirects to a success 
>> page when submitted...
>> Would it be as simple as doing something with the cache control? Basically 
>> I'm trying to avoid someone submitting a form... Then hitting back, and 
>> submitting again, then hitting back.... I think you get the idea...
>> What do you all do?
>> Jason Pruim
> 
> 
> Hi,
> I am using $_SESSION for this. Set a value on the initial page, a timestamp 
> is a good choice, then validate the value on the receiving script and clear 
> the value.
> 
> I like to use a timestamp because it will allow you to deny a comment which 
> took too long to submit.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

I've always tended to stay away from session for that, as when the browser 
closes/restarts, the page is accessible again.

--- End Message ---
--- Begin Message ---

Mike Mackintosh <mike.mackint...@angrystatic.com> wrote:

>
>
>On Aug 24, 2011, at 11:52, John Black <s...@network-technologies.org>
>wrote:
>
>> On 08/24/2011 03:04 AM, Jason Pruim wrote:
>>> Wondering what everyone does to prevent multiple form submissions?
>>> My form is simply getting emailed to my email, and it redirects to a
>success page when submitted...
>>> Would it be as simple as doing something with the cache control?
>Basically I'm trying to avoid someone submitting a form... Then hitting
>back, and submitting again, then hitting back.... I think you get the
>idea...
>>> What do you all do?
>>> Jason Pruim
>>
>>
>> Hi,
>> I am using $_SESSION for this. Set a value on the initial page, a
>timestamp is a good choice, then validate the value on the receiving
>script and clear the value.
>>
>> I like to use a timestamp because it will allow you to deny a comment
>which took too long to submit.
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>I've always tended to stay away from session for that, as when the
>browser closes/restarts, the page is accessible again.
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

I solved this issue with timestamps stored in the db with the submission. With 
each submission, I took all the info that should make it uniqueish, and checked 
if it was near another one. A time limit of 10th seconds worked out well. The 
reason I had the problem was because we were triggering a counter on an account 
from get data (which the browser can request in a way that looks like multiple 
submissions). We should have used post, which didn't have this problem though 
really.

Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

--- End Message ---
--- Begin Message ---
On Wed, Aug 24, 2011 at 3:46 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> I solved this issue with timestamps stored in the db with the submission.

This seems like the one sure way to control it. Cookies can be denied,
session can be reset, js methods can be noscripted, etc.

--- End Message ---
--- Begin Message ---



On Aug 24, 2011, at 3:46 PM, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:

> 
> 
> Mike Mackintosh <mike.mackint...@angrystatic.com> wrote:
> 
>> 
>> 
>> On Aug 24, 2011, at 11:52, John Black <s...@network-technologies.org>
>> wrote:
>> 
>>> On 08/24/2011 03:04 AM, Jason Pruim wrote:
>>>> Wondering what everyone does to prevent multiple form submissions?
>>>> My form is simply getting emailed to my email, and it redirects to a
>> success page when submitted...
>>>> Would it be as simple as doing something with the cache control?
>> Basically I'm trying to avoid someone submitting a form... Then hitting
>> back, and submitting again, then hitting back.... I think you get the
>> idea...
>>>> What do you all do?
>>>> Jason Pruim
>>> 
>>> 
>>> Hi,
>>> I am using $_SESSION for this. Set a value on the initial page, a
>> timestamp is a good choice, then validate the value on the receiving
>> script and clear the value.
>>> 
>>> I like to use a timestamp because it will allow you to deny a comment
>> which took too long to submit.
>>> 
>>> -- 
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>> 
>> 
>> I've always tended to stay away from session for that, as when the
>> browser closes/restarts, the page is accessible again.
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> I solved this issue with timestamps stored in the db with the submission. 
> With each submission, I took all the info that should make it uniqueish, and 
> checked if it was near another one. A time limit of 10th seconds worked out 
> well. The reason I had the problem was because we were triggering a counter 
> on an account from get data (which the browser can request in a way that 
> looks like multiple submissions). We should have used post, which didn't have 
> this problem though really.
> 
> Will you please show an example of using this timestamp methodology?

Thank you

> 

--- End Message ---
--- Begin Message ---
On 24.08.2011 21:38, Mike Mackintosh wrote:
On Aug 24, 2011, at 11:52, John Black<s...@network-technologies.org>  wrote:
On 08/24/2011 03:04 AM, Jason Pruim wrote:
Wondering what everyone does to prevent multiple form submissions?
My form is simply getting emailed to my email, and it redirects to a success 
page when submitted...
Would it be as simple as doing something with the cache control? Basically I'm 
trying to avoid someone submitting a form... Then hitting back, and submitting 
again, then hitting back.... I think you get the idea...
What do you all do?
Jason Pruim
I am using $_SESSION for this. Set a value on the initial page, a timestamp is 
a good choice, then validate the value on the receiving script and clear the 
value.
I like to use a timestamp because it will allow you to deny a comment which 
took too long to submit.
I've always tended to stay away from session for that, as when the browser 
closes/restarts, the page is accessible again.

True, a SESSION can be reset by closing the browser but I am not trying to deny a user from submitting different information again. I want to prevent them from submitting the same data again by accident (back button or refresh).

A visitor, enters on the form UI page, the session is set, user submits and the form will reset the value in session to null or destroy it.

If the visitor attempts to resubmit by using refresh then it will fail because session does not contain an expected value anymore. That value is generated on the UI page.

If the user goes back with the back button then the browser should display the page from cache. The script will not be called and it will not create a new session value. If the browser does not use the cache it will have to reload the form. This will create a new session value and an empty form so the user may type a new message. This is like attempting to submit a new message and is something I don't block.


I do it this way because I don't want to prevent a visitor to submit new information and I don't think that the original question wanted that.
--
John

--- End Message ---
--- Begin Message ---
Thanks Bastien for your suggestion.
Though, I use the `root` account with `All privileges' but it still not
allowing me to call `drop database'.
What should I do next?

On Wed, Aug 24, 2011 at 6:25 PM, Bastien <phps...@gmail.com> wrote:

>
> On 2011-08-23, at 6:44 AM, Nam Gi VU <nam.gi...@gmail.com> wrote:
>
> > Hi every one,
> > When trying to run my database script with `drop database` command, the
> server refuse and said as below screenshot.
> > What should I do to enable this command?
> >
> > Regards,
> > Nam
> >
> >
> >
>
>
> Check that you phpmyadmin user account has the drop privilege. If not,
> grant that privilege or create another user account that does have more
> privileges
>
> Bastien




-- 
Nam

--- End Message ---
--- Begin Message ---
On Wed, Aug 24, 2011 at 1:30 PM, Nam Gi VU <nam.gi...@gmail.com> wrote:
> Thanks Bastien for your suggestion.
> Though, I use the `root` account with `All privileges' but it still not
> allowing me to call `drop database'.
> What should I do next?
>
> On Wed, Aug 24, 2011 at 6:25 PM, Bastien <phps...@gmail.com> wrote:
>>
>> On 2011-08-23, at 6:44 AM, Nam Gi VU <nam.gi...@gmail.com> wrote:
>>
>> > Hi every one,
>> > When trying to run my database script with `drop database` command, the
>> > server refuse and said as below screenshot.
>> > What should I do to enable this command?
>> >
>> > Regards,
>> > Nam
>> >
>> >
>> >
>>
>>
>> Check that you phpmyadmin user account has the drop privilege. If not,
>> grant that privilege or create another user account that does have more
>> privileges
>>
>> Bastien
>
>
> --
> Nam
>

try creating another user account, that isn't root (always a good
habit) and giving that account the needed privileges and then
configure PMA to use that account.

-- 

Bastien

Cat, the other other white meat

--- End Message ---

Reply via email to