Page 1 of 1
many refreshes
Posted: Tue Sep 07, 2004 7:02 pm
by newmember
what happens when user refreshes page so fast that there is not enough time (between refreshes) for php script to run to the end?
each time server will launch new instance of the same script(php page)?
Posted: Tue Sep 07, 2004 7:30 pm
by Joe
I think it may slow the server down a little as so many requests are sent. Not sure on that one...
Posted: Tue Sep 07, 2004 8:56 pm
by feyd
a new instance of the page will launch, while the others are still finishing.. but they will finish. This is the same problem with high-volume sites running non-cached code. Running on a higher-end server can aleviate this a lot.. running on a load balanced cluster, really helps.
Posted: Wed Sep 08, 2004 4:01 am
by newmember
on the same subject...
what happens when user opens the same page a few times?
in this case also there will be separate script instance launch for each open page on user's side?
Posted: Wed Sep 08, 2004 4:09 am
by feyd
yes.
Posted: Wed Sep 08, 2004 4:16 am
by newmember
lets say that this page contains form... so each instance of script will get this form and work on it...
but it is a real problem because the intention was to recieve only one form...
how do you treat this situation?
Posted: Wed Sep 08, 2004 4:27 am
by feyd
it only gets 1 form, for each instance sent back. the processor gets a submission, and spits whatever it needs to back.
Posted: Wed Sep 08, 2004 4:39 am
by newmember
i didn't undestand you... maybe i was not clear in my question....i'll try again
i open at the same time in my browser the same page 5 times. each page has a form. i fill all 5 forms and hit submit for each of them. now, you say that for each submission i make, server will launch the same script 5 times...each script proccess form's data and does something with it...
so here is the problem because i don't want five instances to work on the same form...
Posted: Wed Sep 08, 2004 4:52 am
by feyd
you want the form to only work once? ever? then it needs to be built to stop responding after a single access, or stop responding once each passes through it successfully.
Posted: Wed Sep 08, 2004 5:26 am
by newmember
ok thanks
(i hoped php has some mechanism for dealing with such situations...)
Posted: Wed Sep 08, 2004 8:52 am
by AVATAr
newmember wrote:ok thanks
(i hoped php has some mechanism for dealing with such situations...)
You have to build one..

Posted: Wed Sep 08, 2004 9:46 am
by mikeb
Multiple form posts can be a pain. If the data is being dumped into a database table, then try an approach like this:
Code: Select all
//include an email field on form
- user posts form
//Your script on the server
- Query database for existence of user's email
- Is user's email already in database?
NO{
- Stick user email into database
- Stick form data into database (or email it or whatever)
}
YES - Ignore user form input
- end
Same thing could be acheived using session variables and checking for their existence with the same YES/NO responses
The problem with this is that you are not giving the user a chance to correct a form which they posted incorrectly! Many sites simply have a message 'PRESS THE SUBMIT BUTTON ONCE ONLY, FORM MAY TAKE A FEW SECONDS TO POST' lol! sometimes that might be the best thing,
cheers,
Mike