SalientAnimal Posted January 15, 2014 Share Posted January 15, 2014 Hi All, I have managed to setup my login / registration page for my website. The only thing is when a user finishes registering they need to login before they can carry using the site. I have two senarios here and would like some recommendations please: Senario When registering the user only completes very basic information, so as to help with avoiding duplicate entries in the data base, and a user not have to fill in an entire form from scratch. Once completing the basic registration, Username, Password, E-Mail, the get directed to the second part of the registration process where they will need to capture additional information. When moving onto step 2 of the registration process, I would like a message to show "Hello [selected username] please complete the last part of registration". When completing the additional information their membership level will also be updated from level 0 - level 1 which will allow them to access the first level of all pages. Should registration at stage 2 not be completed for whatever reason, the level 0 user details will be saved so that registration can be completed later. Can anyone suggest the best way of doing this? The souce code I am currently using can be found here: http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL. Quote Link to comment Share on other sites More sharing options...
KaiSheng Posted January 16, 2014 Share Posted January 16, 2014 (edited) 3rd point can only be done when they are logged in. echo SESSION id that takes the username. ----------- 4th point can be done by UPDATE in the query. for example, when they registered for an account, by default their level is 0. your register query should capture that. At the page where the UPDATE starts, you should add into the query for update for the field level. e.g UPDATE user SET level = '1' (or something like SET level = <?php $current_level + 1?>) Not sure about the punctuations. ------------ 5th point, the level 0 details should be already be saved at stage 2. Therefore, this point is unnecessary. ---------- 1st and 2nd point just leads them pages to pages. And remember, at the stage of 2nd point, they must be logged in. Edited January 16, 2014 by KaiSheng Quote Link to comment Share on other sites More sharing options...
SalientAnimal Posted January 16, 2014 Author Share Posted January 16, 2014 ---------- 1st and 2nd point just leads them pages to pages. And remember, at the stage of 2nd point, they must be logged in. Still in the process of learning PHP and mySQL, my problem is "forcing" the login between point 1 and 2. How do I "Auto" log the user in between these points? I don't want them to be able to access the site if they have not completed the registration. On point 4, I would like to store the additional user info in a seperate table to the members table, so am I correct in saying that when submitting at this point I will be updating my user table, as well as inserting a new entry into my userdetail table? User level is defined by the department that the user is in, as well as if they are a manager, team leader, general user. On point 5, I would like them to be able to login with the details they used to register, but when logging in they will automatically be taken to the page to complete registration, how is this administered in my login success script? Thanks, your feedback so far has really helped, I have an idea of what I can start doin now to get closer to completetion. Quote Link to comment Share on other sites More sharing options...
KaiSheng Posted January 17, 2014 Share Posted January 17, 2014 If the user didn't logs in, even if you are able to save the additional details, you won't be able to know that additional details is for which person. in which this case, i called it as (SESSION id) This is not possible to force the login between point 1 and 2. You do not want them to access the site if they have not complete the registration. Another way you can do is to add an additional field called status maybe? For e.g (once they registered,their status by default is 0. Once they login, you redirect them to the additional details page, once they updated that, their status changes to 1. using insert & update query) followed on, on your home page, or any page that you said you do not want them to access, you can come up with a condition, if ($status == 0) { echo "Please update your additional information before carry on"; } else { paste the whole code here } This way they will be only able to view the page ONCE they have updated their additional information. Which that page also is the page that changes their 'status'. I hope you understand. ------------------- Point 4, you are correct. Point 5, In your login success script, you can put this at the top of your code. (it must be the first line of your code page.) header("Location: www.addAdditionalInfo.php") Quote Link to comment Share on other sites More sharing options...
SalientAnimal Posted January 17, 2014 Author Share Posted January 17, 2014 Point 5, In your login success script, you can put this at the top of your code. (it must be the first line of your code page.) header("Location: www.addAdditionalInfo.php") Thanks, will start working on this and let you know how it goes. Just another question on point 5, if I add the suggested code to the top of the page, won't they always be redirected to this page when logging in? The would only need to directed to this page the first time. Quote Link to comment Share on other sites More sharing options...
KaiSheng Posted January 17, 2014 Share Posted January 17, 2014 Yeah, for that you need to come up with another condition inside a condition. Quote Link to comment 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.