Acceptable Extra characters
Posted: Tue Jul 27, 2004 9:15 am
I modified the code of this topic
viewtopic.php?t=24191
to a random generating password script with at least 1 digit and one extra character.
I plan to use those passwords with the http://www.authentication. Does anyone have a list of which extra charaters are allowed?
Any input on which chars to avoid is also appreaciated. (I already took out I and l and O and 0 to avoid possible confusion)
Thanks
viewtopic.php?t=24191
to a random generating password script with at least 1 digit and one extra character.
Code: Select all
<?php
srand((double)microtime()*1000000);
$acceptable_chars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ123456789";
$acceptable_num = "123456789";
$acceptable_extra = "#%ยง*!%";
$password_length = 8;
do {
$extra_rand = rand(0, $password_length - 1);
$num_rand = rand(0, $password_length - 1);
} while ($extra_rand == num_rand) ;
for($i = 0;$i < $password_length;$i++) {
if ($i == $extra_rand) {
$new_pass .= substr($acceptable_extra, rand(0,strlen($acceptable_extra) - 1), 1);
} elseif ($i == $num_rand) {
$new_pass .= substr($acceptable_num, rand(0,strlen($acceptable_num) - 1), 1);
} else {
$new_pass .= substr($acceptable_chars, rand(0,strlen($acceptable_chars) - 1), 1);
}
}
?>Any input on which chars to avoid is also appreaciated. (I already took out I and l and O and 0 to avoid possible confusion)
Thanks