Exemple #1
0
function pass_gen() {
$random_password = "";
$a = 0;
while ($a < NUM_TEXT_CHARS) {
	if (LOWER_AND_UPPER) {
		if(EXCLURE_CARACT_CONFUS) {
			$random_char[$a] = alphabet(rand(0,46));
		}
		else {
			$random_char[$a] = alphabet(rand(0,51));
		}
	} else {
		if(EXCLURE_CARACT_CONFUS) {
			$random_char[$a] = alphabet(rand(0,22));
		}
		else {
			$random_char[$a] = alphabet(rand(0,25));
		}
	}
	$a++;
}
while ($a < (NUM_TEXT_CHARS + NUM_NUMERIC_CHARS)) {
	if(EXCLURE_CARACT_CONFUS) {
		$random_char[$a] = rand(2,9);
	}
	else {
		$random_char[$a] = rand(0,9);
	}
	$a++;
}
$a = 0;
while ($a < (NUM_TEXT_CHARS + NUM_NUMERIC_CHARS)) {
	$random_password .= $random_char[$a];
	$a++;
}
return $random_password;
}
function _alphabet($string)
{
    return !alphabet($string);
}