bal bal Posted March 13, 2009 Share Posted March 13, 2009 hi when I logged in, the details (user ID & last loggin in time) should show in each pages... can anyone please help me how can I do this? I have got login page with user name and password. when I logged in, it shows the details in the in each pages untill I logged out. can anyone please help to how can I do this? thanks Quote Link to comment Share on other sites More sharing options...
Malevolence Posted March 13, 2009 Share Posted March 13, 2009 how have you stored these details? What is the login method you used? Is there a database involved, etc. etc. Quote Link to comment Share on other sites More sharing options...
kittrellbj Posted March 13, 2009 Share Posted March 13, 2009 If you're trying to display those details on each page, you could use an include on each page to display these details. <?php // Your database connection info, session setup, // and etc. goes here. $userid = $_SESSION['id']; // Or however you retrieve it. $data = mysql_fetch_assoc(mysql_query("SELECT * FROM table WHERE id='" . $userid . "'")); echo "Hello, " . $data['username'] . "! Your last login was " . $data['lastlogin']; ?> Then, use include(...) to include that in each page, or incorporate it into something that's already included. Quote Link to comment Share on other sites More sharing options...
bal bal Posted March 14, 2009 Author Share Posted March 14, 2009 how have you stored these details? What is the login method you used? Is there a database involved, etc. etc. i've got a table called log_dtls where it stores the user name and password. what I want is, when I logged in, it should show the user name and the last login details, like when logged in before. it should like the bank account page, when you logged in your account, it shows your name and when you last logged in.... thanks Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 14, 2009 Share Posted March 14, 2009 when the user logs in, store the name and logged in time to a session variable, then just echo the session variables out on each page you want Quote Link to comment Share on other sites More sharing options...
bal bal Posted March 14, 2009 Author Share Posted March 14, 2009 when the user logs in, store the name and logged in time to a session variable, then just echo the session variables out on each page you want should I use session_start(); in every pages? Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 14, 2009 Share Posted March 14, 2009 if you are using session variables, yes you have to Quote Link to comment Share on other sites More sharing options...
bal bal Posted March 14, 2009 Author Share Posted March 14, 2009 if you are using session variables, yes you have to cheers wolf..... 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.