curbsy Posted November 11, 2005 Share Posted November 11, 2005 Ok, I'm having some troubles with sessions. I don't really understand how they work at all. Can somebody help me on this? Link to comment Share on other sites More sharing options...
Paim Posted November 11, 2005 Share Posted November 11, 2005 Well....When someone generally logs in, the username and password they enter are input into a 'session variable' that stays with them no matter what page they visit. Session variables are like $_SESSION['blah'] and can be called on any page that has: <?php session_start(); ?> at the top of the page (before the <html> tag). This will get all of the session variables that are currently in use. Then you can do things such as: if ($_SESSION['user']) {//any commands or things to show while the user is logged in}else {// message or something telling them they need to log in to view the content} It may take a while, but practice by inputting things into a session variable: $blah = $_POST['username'];$_SESSION['blah'] = $blah; then putting the session_start() on another page, and typing <?phpecho $_SESSION['blah'];?> Err thats all tha tI can think of, not sure if its clear enough. Any questions feel free to ask. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now