Ik heb deze code
nu krijg ik deze error
nu weet ik dat het foute scriptje erin zit
en ik weet ook dat dit scriptje erin moet:
Wie weet hoe dit erin moet en kan het er voor mij erin zetten
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: index.php"[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]login[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$mysql_host[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]#[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$mysql_usr[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]#[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$mysql_pw[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]#[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$mysql_db[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]#[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$con[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_connect"]mysql_connect[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql_host[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$mysql_usr[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$mysql_pw[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$mysql_db[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$pass[/COLOR] [COLOR= #007700]=[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]whirpool[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$hash[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$saltPos[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #0000BB]$salt[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$hash[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$saltPos[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$password[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$login[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM accounts WHERE username = $username AND password = $password"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]] =[/COLOR] [COLOR= #0000BB]$username[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Location: index.php"[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Wrong username and/or password!"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<html>
<head>
</head>
<body>
<center>
<form action="" method="POST" >
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="password" /><br />
<input type="submit" name="login" value=" Login! " />
</form>
</center>
</body>
</html>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?> nu krijg ik deze error
Warning: hash() [function.hash]: Unknown hashing algorithm: whirpool in /home/#/#/#-#.com/public_html/#/lol.php on line 17 nu weet ik dat het foute scriptje erin zit
en ik weet ook dat dit scriptje erin moet:
function encryptPassword($password) {
$salt = substr(hash(whirlpool, uniqid(rand(), true)), 0, 12);
$hash = hash(whirlpool, $salt . $password);
$saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password));
return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
} function checkPassword($checkPass, $realPass, $algorithm) {
switch ($algorithm) {
case 1:
return $realPass == hash(whirlpool, $checkPass);
case 2:
return $realPass == hash(md5, $checkPass);
case 3:
return $realPass == hash(sha1, $checkPass);
case 4:
return $realPass == hash(sha256, $checkPass);
default:
// xAuth hashing
$saltPos = (strlen($checkPass) >= strlen($realPass) ? strlen($realPass) : strlen($checkPass));
$salt = substr($realPass, $saltPos, 12);
$hash = hash(whirlpool, $salt . $checkPass);
return $realPass == substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
}
} Wie weet hoe dit erin moet en kan het er voor mij erin zetten

