whirepool login

Gestart doorJacmob4 reacties24 weergaven

5 berichten · pagina 1 van 1

Jacmob

Lid · Topicstarter

Berichten
916
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik heb deze code

[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 smile
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();

function[/COLOR] encryptPassword[COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$salt[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR]hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]whirlpool[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/uniqid"]uniqid[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700](),[/COLOR] true[COLOR= #007700])),[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]12[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$hash[/COLOR] [COLOR= #007700]=[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]whirlpool[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$salt[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$password[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$saltPos[/COLOR] [COLOR= #007700]= ([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$password[/COLOR][COLOR= #007700]) >=[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$hash[/COLOR][COLOR= #007700]) ?[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$hash[/COLOR][COLOR= #007700]) :[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$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]);
}


function[/COLOR] checkPassword[COLOR= #007700]([/COLOR][COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$realPass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$algorithm[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/switch"]switch[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$algorithm[/COLOR][COLOR= #007700]) {
    case[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]:[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$realPass[/COLOR] [COLOR= #007700]==[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]whirlpool[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]);
    case[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]:[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$realPass[/COLOR] [COLOR= #007700]==[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]md5[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]);
    case[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700]:[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$realPass[/COLOR] [COLOR= #007700]==[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]sha1[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]);
    case[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700]:[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$realPass[/COLOR] [COLOR= #007700]==[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]sha256[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]);
    default:[/COLOR]
        [COLOR= #FF8000]// xAuth hashing[/COLOR]
        [COLOR= #0000BB]$saltPos[/COLOR] [COLOR= #007700]= ([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]) >=[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$realPass[/COLOR][COLOR= #007700]) ?[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$realPass[/COLOR][COLOR= #007700]) :[/COLOR] [URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]));[/COLOR]
        [COLOR= #0000BB]$salt[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/substr"]substr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$realPass[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$saltPos[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]12[/COLOR][COLOR= #007700]);[/COLOR]
        [COLOR= #0000BB]$hash[/COLOR] [COLOR= #007700]=[/COLOR] hash[COLOR= #007700]([/COLOR][COLOR= #DD0000]whirlpool[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$salt[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$checkPass[/COLOR][COLOR= #007700]);[/COLOR]
        [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$realPass[/COLOR] [COLOR= #007700]==[/COLOR] [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]

[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]
?>
0
Jacmob

Lid · Topicstarter

Berichten
916
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Warning: hash() [function.hash]: Unknown hashing algorithm: whirpool in /home/#/public_html/lol.php on line 45

die error krijg ik nu confused
0
Berichten
3.112
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
whirlpool is geen bestaande hash?
0
Jacmob

Lid · Topicstarter

Berichten
916
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
heb gevonden er stond whirpool inplaats van whirlpool
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren