osherdo Posted December 22, 2014 Share Posted December 22, 2014 Hello everyone. I have a fully working form that gets data from a user (with $_post array) , and stores it in a database (mysql). After successfulIy filling the form, I refer him to the "dashboard" page. In this page, i am having trouble to get his details from the database. How should I recognize him as the user that just registered? should I use a $_post? or maybe a session? could you please give me a clue how to solve this? Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/ Share on other sites More sharing options...
requinix Posted December 22, 2014 Share Posted December 22, 2014 Log them in after registering. Which entails putting stuff into the session. Which is how you recognize them. Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/#findComment-1500342 Share on other sites More sharing options...
osherdo Posted December 22, 2014 Author Share Posted December 22, 2014 When should i start the session? and where? in the registration page or at the dashboard, the page that the user is redirected after registration? Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/#findComment-1500352 Share on other sites More sharing options...
CroNiX Posted December 22, 2014 Share Posted December 22, 2014 You need session_start(); at the top of any page that will use session. When you log the user in, fill session with their appropriate details. You can then check $_SESSION['some_var'] on any other pages to check that they are logged in and do things like display their username, or whatever you want to do. Have you read up on sessions? Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/#findComment-1500386 Share on other sites More sharing options...
osherdo Posted December 22, 2014 Author Share Posted December 22, 2014 I will get down on it. This topic seems so complex. Although, you did gave me some headstart to go from. Thank you, and I will update here as soon as I get this topic solved. Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/#findComment-1500427 Share on other sites More sharing options...
hansford Posted December 23, 2014 Share Posted December 23, 2014 It's not complex, just new to you. Wherever a user can go once they are logged in will require session_start() at the top of the page as CroNiX stated. Absolutely, post any questions, along with relevant code, that's what everyone is here for - to assist you in the journey. Quote Link to comment https://forums.phpfreaks.com/topic/293226-get-current-registered-users-details/#findComment-1500442 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.