ViaThinkSoft CodeLib
This article is in:
CodeLib → Programming aids → PHP
<?php
$chars = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "ä", "ö", "ü",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "Ä", "Ö", "Ü",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
);
$MAX_PASSWORD_LENGTH = 10; // Maximale Passwortlänge
$pass = array(0);
while (count($pass) <= $MAX_PASSWORD_LENGTH) {
echo "probing ";
$password = '';
foreach ($pass as $id) {
$password .= $chars[$id];
}
echo $password."...<br>\n";
do_something_here($password);
$pass[count($pass)-1]++;
for ($i = count($pass)-1; $i > 0; $i--) {
if ($pass[$i] >= count($chars)) {
$pass[$i-1]++;
$pass[$i] = 0;
}
}
if ($pass[0] >= count($chars)) {
for ($i = 0; $i < count($pass); $i++) {
$pass[$i] = 0;
}
array_push($pass, 0);
}
}
?>
Victor-Phillip Negoescu
ViaThinkSoft Gründer
ViaThinkSoft Gründer