Welcome Guest, Not a member yet? Register   Sign In
Thread safe or any idea ?
#1

[eluser]majidmx[/eluser]
Hi All,
The problem is like this , whenever we have a sale somewhere, a script is called in our end, which checks for many values, like, cookie,ip,time,... for preventing double sales by the same user.
But while we were testing, I place two calls to the script in a row.
This is an application which just call a script and that's it, it doesn;t matter whether the scripts executed successfuly or not.
So in this case, while the first one was being executed, the second one arrives and both at the same time make a sale from the same user. because the IP which should be inserted to DB by first execution of script is not complete yet so when second instance's execution check for ip prevention, it's ok and can continue to make a sale.
Do you have any idea how can I prevent the second execution till the first one completes?
At least in critical areas!

Regards,
MajiD Fatemian




Theme © iAndrew 2016 - Forum software by © MyBB