salman_ahad@yahoo.com Posted November 8, 2009 Share Posted November 8, 2009 I have a form on my website where users are allowed to fill it and use the application. How do I create a session for them ? if ( $_POST ['Submit']) { $user = ($_POST ['usernm']); $username = strtolower($user); $userpassword = ($_POST ['userpw']); ... ...//my application where session to be used to deploy. Need help to place this username and password in session. Quote Link to comment Share on other sites More sharing options...
joel24 Posted November 8, 2009 Share Posted November 8, 2009 why would you want to store the password in the session? you'd just verify it to start the session... if ( $_POST ['Submit']) { $user = ($_POST ['usernm']); $username = strtolower($user); $userpassword = ($_POST ['userpw']); session_start(); $_SESSION['username'] = $user; } and then you'd use session_destroy(); in the logout script to end the session. http://www.php.net/manual/en/book.session.php Quote Link to comment Share on other sites More sharing options...
salman_ahad@yahoo.com Posted November 14, 2009 Author Share Posted November 14, 2009 To be frank, I have no knowledge of sessions. All I want is second user at the same time should be in session queue when first is already using it. if ( $_POST ['Submit']) { $user = $_POST ['usernm']; $username = strtolower($user); $password = $_POST ['userpw']; //What does these two lines do? session_start(); $_SESSION['username']=$user; //Do I need to include any file and what? Quote Link to comment Share on other sites More sharing options...
PHPFreaksMaster Posted November 14, 2009 Share Posted November 14, 2009 if ( $_POST ['Submit']) { $user = $_POST ['usernm']; $username = strtolower($user); $password = $_POST ['userpw']; //What does these two lines do? session_start(); $_SESSION['username']=$user; //Do I need to include any file and what? //What does these two lines do? it means that start the session and assign the value username from $user variable into session variable. 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.