Hello, this is my website.
http://cars.uk-graffiti.co.uk
The aim of the site is that its dynamic to different users.
Ie, the home page will change according to your continent.
which is taken in regestration.
My problem:
on the login screen, you can enter and two values and a session will be started.
My code checks that user name and password are the same as in the database, but its not working.
could someone take a look please
<?PHP
session_start();
include 'scps_db.php';
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password))
{
echo "Please enter ALL of the information! <br />";
exit();
}
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' ");
$login_check = mysql_num_rows($sql);
if($login_check =1)
{
while($row = mysql_fetch_array($sql))
{
$f_name = $row['f_name'];
$s_name = $row['s_name'];
$location = $row['location'];
$age = $row['age'];
$email = $row['email'];
}
$_SESSION['f_name'] = $f_name;
$_SESSION['s_name'] = $s_name;
$_SESSION['email'] = $email;
$_SESSION['location'] = $location;
$_SESSION['age'] = $age;
$_SESSION['username'] = $username;
}
else
{
echo "You could not be logged in! Either your username and password do not match, or your password is incorrect!<br/>Please try again!<br />";
}
?>