Hello,
I have a login. Everything works correct, except the password check. I can fill in anything and I Log in. Can anyone help me to check this out?
Thanks in advance!
[php]<?php
session_start();
$username = ($_POST[‘username’]);
$password = ($_POST[‘password’]);
if ($username&&$password)
{
$connect=mysql_connect(“localhost”, “forum”, “”) or die(“Could not connect.”);
mysql_select_db(“name”) or die(“Couldn’t find db”);
$query = mysql_query(“SELECT * FROM users WHERE username=’$username’”);
$numrows = mysql_num_rows($query);
if ($numrows!=0)
{
while ($row = mysql_fetch_assoc($query))
{
$dbusername = $row[‘username’];
$dbpassword = $row[‘password’];
}
// check to see if they match
if ($username==$dbusername&&sha1(md5($password)==$dbpassword))
{
header("location:homee.php");
$_SESSION ['username']=$username;
exit;
}
else
echo("Incorrect password!");
include("index.php");
exit;
}
else
echo(“that user doesn’t exist”);
include(“index.php”);
exit;
}
else
echo("Please enter username and password ");
include(“index.php”);
exit;
?>
Parsed in 0.383 seconds, using GeSHi 1.0.8.4[/php]