I am working on a Zend Framework application with PHP. I have a form for sign up.
Now when a user sign up and got a user name that is available and the process of sign up is still not completed. And selected user name is not still saved in database. So at the same time no another one get same user name.
so please help how i can prevent that no another user can assign the same user name at same time.
for example a user does not exists in database i.e. mannecheema27
so that it should be free to register. But the process of registering takes some time. Perhaps a user receives a phone call or may be some other reason, then I want that the selected user name to be reserved on sever for that time period until user save his/her registration or click on cancel registration button , so that whenever at same time another user check availability of user name i.e. mannecheema27 then in database it does not exists but it must be stored at sever so that no other user gets the same name.
either accept it that the final registration will fail since another user chose this name, or when checking that the username is not registered do a 'reservation entry' in the user database that will then be later used (or at some point in time unreserved).
The second one is more coding, but really the only way to go. If it is an application where you expect a lot of user creations, accept it that the final registration may fail.