I have a user registration system copied from various examples on the forum (thanks ). However I have a problem in that it often runs multiple times and I end up with multiple copies of the same user being registered.
I know I can add a step to check if the registration is already been performed, and I will do this as I want to let the user know that their email or user name is already in use. However, if I return an alert to the user to tell them their user name is already in use, then this check should not really trigger for duplicates or we will regularly be telling users they have already registered when the real problem is just that the script has run twice.
I’m also not completely sure if this would work 100% of the time as I’m not sure if scripts will run atomically or if they can be interrupted in multiple threads.
Below is my server connect script - it sends an email to the user and they need to click on the link to complete registration. This normally results in multiple entries in the user database, and multiple emails.
How do others handle this situation?