I'm trying to make an extremely simple login site. It'll just compare the username and password if they are correct. I've put in an echo to see if it's working properly, though now it seems like I've no idea what I'm doing. The echo message won't appear.
<?php
if (!isset($_POST['username2'])){
$result = @mysql_query('SELECT id, username, password FROM members');
$username2 = $_POST['username2'];
$password2 = $_POST['password2'];
if (!$result) {
exit('<p>Error performing query: '.
myqls_error() . '</p>');
}
while ($row = mysql_fetch_array($result)){
if ($username2 == $username && md5($password2) == $password) {
echo '<p>The user/pass was correct!</p>';
}
}
}
?>
I am connecting to the database earlier in the code. This is the vital code, I now wonder what's wrong with it. Can you see any error with it that I cannot? Thanks. 🙂