Hi,
Ik ben nu bezig met mijn loginscript, maar hij zegt dat mijn wachtwoord incorrect is, terwijl hij juist goed is. Dus er is iets mis met mijn if check.
Kan iemand me daarbij helpen.
PHP
<?php
define('TITEL','Aanmelden');
include 'includes/config.php';
include 'includes/header.php';
if(!isset($_COOKIE['id']))
{
if(isset($_POST['submit']))
{
$errorMelding = '';
if(trim($_POST['naam']) === '' || trim($_POST['wachtwoord']) === '')
{
$errorMelding .= 'Je hebt niet alle velden ingevuld.';
}
else
{
$sql = mysql_query("SELECT * FROM leden WHERE naam = '".mysql_real_escape_string($_POST['naam'])."'");
if(mysql_num_rows($sql) == 0)
{
$errorMelding .= 'Dit account bestaat niet.';
}
else
{
$fetch = mysql_fetch_assoc($sql);
if(hash('sha256', hash('sha512', $_POST['wachtwoord']) != $fetch['wachtwoord']))
{
$errorMelding .= 'Het ingevoerde wachtwoord is incorrect.';
}
}
if(!empty($errorMelding))
{
echo $errorMelding;
}
else
{
$id = $_COOKIE['id'];
set_cookie('id',$id,time()+60*60*24*30);
echo 'Je bent ingelogd';
}
}
}
?>
<form action="" method="post">
<table>
<tr>
<td width="350">Tovenaarsnaam:</td>
<td><input class="text" type="text" name="naam" maxlength="20" /></td>
</tr>
<tr>
<td>Wachtwoord:</td>
<td><input class="text" type="password" name="wachtwoord" maxlength="50" /></td>
</tr>
<tr>
<td><input type="submit" class="text" name="submit" value="- Inloggen! -" /></td>
<td><input type="submit" class="text" name="send" value="- Opnieuw -" /></td>
<td>Nog geen account? | Wachtwoord vergeten?</td>
</tr>
</table>
</form>
<?php
}
else
{
echo '<div id="error">Je bent al op Zweinstein</div>';
}
include 'includes/footer.php';
?>
Toon Meer