Perfidus Posted March 5, 2009 Share Posted March 5, 2009 Hi there! I'm working on a site with a big registration form, first of all a user will be requested and with ajax and php the site informs about availability, the problem is that by the time the user has finished filling the form, the name can be already taken. I don't know exactly how to face this problem the better way even though some posibilities come to my mind none of them seems to be the best one. Any hints? Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/ Share on other sites More sharing options...
KevinM1 Posted March 5, 2009 Share Posted March 5, 2009 Hi there! I'm working on a site with a big registration form, first of all a user will be requested and with ajax and php the site informs about availability, the problem is that by the time the user has finished filling the form, the name can be already taken. I don't know exactly how to face this problem the better way even though some posibilities come to my mind none of them seems to be the best one. Any hints? Hmm...maybe a locking mechanism of some kind? Have a temporary name file/db that stores these in-use (but not fully registered) names so that when someone else tries to register on the site, the script checks both the member db and temp db? Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777635 Share on other sites More sharing options...
PFMaBiSmAd Posted March 5, 2009 Share Posted March 5, 2009 Store ALL the information submitted in the database. This will "reserve" the name and prevent it from being picked by someone else. Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777642 Share on other sites More sharing options...
Perfidus Posted March 5, 2009 Author Share Posted March 5, 2009 Thanks Nightslyr, I have been thinking also about that, but I'm not sure how long must this locking last. About PFMaBiSmAd answer, I'm talking about the time between the ajax-php checks if user exists and the time the user sends the form... Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777647 Share on other sites More sharing options...
trq Posted March 5, 2009 Share Posted March 5, 2009 Why don't you store the users username as soon as it validates as available? Your using ajax after all, no need to wait for the rest of the form to be filled out. Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777659 Share on other sites More sharing options...
Perfidus Posted March 5, 2009 Author Share Posted March 5, 2009 Yes, but you know how many people is fooling around in the forms, and some people may start filling the form and maybe they wont finish the process so I will be collecting rubbish... Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777663 Share on other sites More sharing options...
PFMaBiSmAd Posted March 5, 2009 Share Posted March 5, 2009 Simply use a cron job/scheduled task to delete entries that have not been completed in a reasonable time. Quote Link to comment https://forums.phpfreaks.com/topic/148143-user-duplication-while-doing-registration/#findComment-777666 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.