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
https://forums.phpfreaks.com/topic/96306-remember-username-password/
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

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.