Darkranger85 Posted March 9, 2012 Share Posted March 9, 2012 Hey all, In my user registration system I'm trying to figure something out. When the user puts in his information and hits submit it goes into a temporary user table while it waits for the user to click on the activation code in the email that is sent out. Once they click on it it's then transferred into the user table. Now, I have a few questions: 1. Should the user check on the registration screen check both tables for a username match? What if someone starts a registration but never activates it. That username, though not in use, is now taken up in the tempuser table. 2. Should the information in the temporary table be cleared after it is moved into the regular table? Thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/258599-username-check-question/ Share on other sites More sharing options...
Eiolon Posted March 9, 2012 Share Posted March 9, 2012 There are a few approaches that you can do, but the simplist would be to keep them all in the users table, whether activated or not. Have a column called "activated" as a tinyint and default to 0 for being inactive, and set to 1 for being active. You then don't have to worry about comparing tables or moving and deleting from other tables. Quote Link to comment https://forums.phpfreaks.com/topic/258599-username-check-question/#findComment-1325622 Share on other sites More sharing options...
batwimp Posted March 9, 2012 Share Posted March 9, 2012 I have done these before and I also used a single table for users, like Eiolon said. I also use a 'Status' field in my table, which is used for more than just registered/not registered. I would do something like -1 for 'deleted' users, 0 for unverified email users, 1 for regular users..... up to 5 for admins. Then throughout my code, I could check against that status to see how much of the page to display (more for admins, obviously). etc. Quote Link to comment https://forums.phpfreaks.com/topic/258599-username-check-question/#findComment-1325655 Share on other sites More sharing options...
Darkranger85 Posted March 10, 2012 Author Share Posted March 10, 2012 Thats an awesome idea! That will save me a crap load of work and headaches lol. Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/258599-username-check-question/#findComment-1325749 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.