login script in php using session variables
- by kracekumar
?
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