Jump to content

Need help with sessions


salman_ahad@yahoo.com

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
https://forums.phpfreaks.com/topic/180785-need-help-with-sessions/
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

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?

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.