Hi there,
I have been trying to fix the problem in the below code for a long time, it did work for me at some point. Then, it suddenly stopped storing user's details in a session.
$user = $_POST['username'];
$pass = $_POST['password'];
$query = "SELECT username, password FROM
USERS WHERE username = '$user'
AND password='$pass' ";
$result = mysql_query($query) or mysql_error();
$row = mysql_fetch_assoc($result);
if( $row['username'] == $user ){
$_SESSION['username'] = $row['username'];
$_SESSION['password'] = $row['password'];
header('Location:settings.php');
}
and this is the form where the above mentioned script gets the values from
echo "<form action='log_in.php' method='post' >";
echo "<input type='text' name='username' placeholder='username' ";
echo "<input type='password' name='password' placeholder='password' ";
echo "<input type='submit' value='Log in' > ";
echo "</form>";