Welcome Guest, Not a member yet? Register   Sign In
prevention of the same user to run the script twice [multithreading?]
#1

[eluser]majidmx[/eluser]
Hi,
Here is the problem.
We have a script which is being called within page in another server.

All the user's information will be passed to us as well [cookie, ip , ... ].

By sometimes they have several copies of our script on their page (by mistake), so when a user visits the page our script is being executed twice, which is not desired for us.

We want each user to have the ability of executing our script one and only one time.
In our script we have preventions for : cookie , IP / Time, for each user.
I mean we set a cookie on user's side and every time we check the existence of that cookie.
Also we save the IP/Time in DB and check it too.
in the cases when the script is being executed exactly at the same time none of them work.

Is it something related to multi-threading ?

Does it have anything with Apache "Thread Safety " ?

I was thinking of while the first request to save the info to DB is being executed, the second request for the script arrives and easily pass the DB checking because it's not still being inserted to DB !

Any idea will be helpful and I'll appreciate it.
Thanks,
MajiD


Messages In This Thread
prevention of the same user to run the script twice [multithreading?] - by El Forum - 02-11-2009, 02:17 PM



Theme © iAndrew 2016 - Forum software by © MyBB