Jump to content

Remember Username & Password


webgenius

Recommended Posts

At present I'm using $_SESSION['UserName'] to create and store the login details. But I'm not able to access this session variable. Is there any way for the website to remember these details?

 

$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.php"
session_start();
session_register("myusername");
session_register("mypassword");
$_SESSION['loginname'] = $myusername;
//echo $_session['loginname'];
header("location:index.php");
}

 

I'm using <?php echo $_session['loginname']; in index.php. Is there anything wrong with the code?

Link to comment
Share on other sites

not sure if $_session['loginname'] is case sensitve... but try accessing it by $_SESSION['loginname']

 

Also, you have to have session_start(); on each page you want to access the $_SESSION

Problem solved. It was just the wrong usage of $_session, as you said. Thanks a lot. ;D

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.