Displaying the articles when it is not suppose to???
Posted: Wed Aug 09, 2006 11:31 pm
My code is displaying the articles regardless of what I type into the form fields and it is not suppose to. Can someone please tell me why this is happening? Thanks in advance. 
Here is the code that I am working with:
Here is the code that I am working with:
Code: Select all
require "config2.php";
//Only validate if the Submit button was clicked.
if (!empty($_POST['Submit'])) {
$_POST['password'] = md5($_POST['password']);
$login_check = "SELECT * FROM users WHERE username='". mysql_real_escape_string($_POST['username']) . "' AND password ='". mysql_real_escape_string($_POST['password']) . "'";
$login_query = mysql_query ( $login_check ) or die ( 'Query failed. ' . mysql_error () );
$login_result = mysql_result ( $login_query, 0, 0 );
if ($login_result != 1) {
setcookie ("username", $_POST['username']);
setcookie ("password", $_POST['password']);
header('Location: articles.php');
exit;
} else {
echo "<center>Sorry, you don't know who you are!</center>";
}
}
mysql_close();