Lid |
|
Goedenmiddag,
ik moet voor school een login-script maken. Alleen ik heb bij registratie wel voor elkaar gekregen dat hij hem in md5 plaatst alleen ik weet niet waar ik hem dan in me inloggen.php moet zetten. Ik heb hier de code van inloggen.php meegestuurd en ik hoop dat iemand me eruit kan helpen.
Met vriendelijke Groet,
Mike Koopman
<?PHP
include 'mysql.php' ;
session_start();
$username = $_POST['username'];
$password = md5($_POST['password']);
if (isset($username) && isset($password))
{
$query = mysql_query("SELECT * FROM leden WHERE username='$username' and password='$password'");
$numrows = mysql_num_rows($query);
if ($numrows != 0)
{
while ($row = mysql_fetch_assoc($query))
{
$username = $_POST['username'];
$password = $_POST['password'];
}
// check to see if they match!
if ($username&&$password)
{
echo "<center>You're in!<br><a href='member.php'>Click here</a> to enter the member page.</center> ";
$_SESSION['username'] = $username;
}
}
else
{
echo "<center>That user doesn't exist or incorrect password!</center>";
exit;
}
}
else
{
die("<center>Please enter and username and password!</center>");
}
?>
<?PHP include 'mysql.php' ; $username = $_POST['username']; $password = md5($_POST['password']); { $query = mysql_query("SELECT * FROM leden WHERE username='$username' and password='$password'"); if ($numrows != 0) { { $username = $_POST['username']; $password = $_POST['password']; } // check to see if they match! if ($username&&$password) { echo "<center>You're in!<br><a href='member.php'>Click here</a> to enter the member page.</center> "; $_SESSION['username'] = $username; } } else { echo "<center>That user doesn't exist or incorrect password!</center>"; } } else { die("<center>Please enter and username and password!</center>"); } ?>
|