Jump to content

Need help with sessions


Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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. :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.