login script in php using session variables
Posted
by kracekumar
on Stack Overflow
See other posts from Stack Overflow
or by kracekumar
Published on 2010-06-17T21:32:00Z
Indexed on
2010/06/17
21:33 UTC
Read the original article
Hit count: 131
php5
?>
username:
';
}
else
{
$user=$_POST['user'];
$query="select name from login where name='$user'";
$result=mysql_query($query) or die(mysql_error());
$rows=mysql_num_rows($result)or die(mysql_error());
session_start();
//echo "results";
$username=mysql_fetch_array($result) or die(mysql_error());
$fields=mysql_num_fields($result) or die(mysql_error());
echo "username:$username[0]";
$_SESSION['username']=$username[0];
$sesion_username=$_SESSION['username'];
//echo "rows:$rows"."
"."fields:$fields";
echo"
"."username:$sesion_username";
} ?>
i wanted to create a site where user can login and upload their details depending on their user name have stored their details in a database,the problem i am facing is two people 'a' and 'b' login one after other session_variable $_SESSION['username'] will have 'b's' username ,so i can't display 'a's' details now. . . .
what i want to achieve is when a user logins in i want to store his name and other details in session variable and navigate him according and display his details
© Stack Overflow or respective owner