Jump to content

Session issues


psychohagis

Recommended Posts

I have a log-in script, and once everything has been verified it iniated the session as follows,

[code=php:0]session_start();
$_SESSION['userid'] = $userid;
$_SESSION['username'] = $_POST['username'];[/code]

Then i have script which checks for a session which is as follows

[code=php:0]if (!isset($_SESSION['userid']) or $_SESSION['userid'] =='')
{
echo '<a href=/members/signup.php>sign up</a>&nbsp|&nbsp<a href=/members/signin.php>sign in</a>';
} else {

$username=$_SESSION['username'];

echo 'signed in as <a href=/members/>' . $username . '</a>&nbsp|&nbsp<a href=/members/signout.php>sign out</a>

}[/code]

However, this asks me to log-in, even when I have.

Have I started the session incorectly, what could be causing this?
Link to comment
https://forums.phpfreaks.com/topic/32698-session-issues/
Share on other sites

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.