session related...
-
I created a login page with session, login and making session working good but there is a problem that when a user login successfully his/her Firstname and last name should be apear in the Welcome Page e.g( a username "reehan" logged in with his password, he logged in successfully and redirected to another page there message should be show "Welcome! Reehan Munir" Rehan Munir could be retrieve from database of that particular user "reehan") have any idea about that. m.reehanmunir
-
I created a login page with session, login and making session working good but there is a problem that when a user login successfully his/her Firstname and last name should be apear in the Welcome Page e.g( a username "reehan" logged in with his password, he logged in successfully and redirected to another page there message should be show "Welcome! Reehan Munir" Rehan Munir could be retrieve from database of that particular user "reehan") have any idea about that. m.reehanmunir
There are several ways to do that. For example when the user logs in, the query you use to check for the login / password could also retrieve the first and last name, and you could pass them to the other page through querystring, or session variables. Another way is when the user logs in, pass the user id with either querystring or session variable and then query again to retrieve the information. What I usually do, is create a 'user' class that contains the details of the user, then when I check login / password I also retrieve all the details of the user, then I store all this information in a 'user' instance and keep this object in a session variable. So as long as this object exists in the session variable, you know the details of the logged in user, if not (session variable is null), then I redirect to the login page. daniero