Re: Any conflict with $_POST when 2 users concurrently submitting the same form using POST method?

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

 



Keith wrote:
> Let's say user A and user B submitting purchase order form with
> "order.php" at the same time, with method=post action='confirmation.php'.
> 
> (1)   Will $_POST['order'] submitted by user A replaced by
> $_POST['order'] submitted by user B, and the both user A & B getting the
> same order, which is made by user B? Why?
> 
> (2)    Since $_POST['xxx'] is superglobal array, will $_POST['order']
> read by users other than A & B? In shared hosting server environment,
> are all domains hosted within that server using the same $_POST array?
> Can $_POST array accessible by all domains even if not from the
> originating domain?
> 
> Thx for clarification!
> 
> Keith

Other posters have explained, but I'm not sure their explanations are clear.
Think of it like this:

User A posts to "confirmation.php". When the server receives the request, it
starts up a Process and fills the $_POST array with whatever came in, then runs
confirmation.php with that information.

User B posts to "confirmation.php". When the server receives the request, it
starts up a Process and fills the $_POST array with whatever came in, then runs
confirmation.php with that information.

The KEY thing is that the process in each case is entirely separate. Each makes
it's own copy of the script in its own bit of memory, and each has its own
version of $_POST in its own bit of memory.

The two posts can happen at the same time and they will still be completely
independent.

The fact that $_POST is called "superglobal" does not mean that it is shared by
separate requests - it is not even shared by requests in the same session. It
just means that it is already declared and you don't need to use the "global"
keyword to access it in your PHP pages.

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
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