[PHP] Random Password Generator 02-11-2013, 06:48 PM
#1
Hello guys! Well here's another of my codes. This is basically a random password generator not an advanced one but works for the purpose.
The output of the script is like this:
![[Image: MFTVlWm.png]](http://i.imgur.com/MFTVlWm.png)
If you want to increase the length of your password add those lines to your needs in the generator function:
To increase password strength or make it looks less familiar add more letters, symbols, numbers and combos to the array.
Have fun
Regards,
Exo94
PHP Code:
<html>
<head>
<title>Exo94's Random Password Generator - PHP</title>
</head>
</html>
<?php
/////////////////////////////////////
//Random Pass Generator By Exo94////
//Coded by Exo94 in PHP ///////////
//http://www.gigadev.tk///////////
//hackcommunity.com//////////////
//Give Proper Credits if used!//
///////////////////////////////
//Array to store all the letters
$alpha = array('a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z');
//Array that stores the final output that is the generated password for display to the user
$output = array();
function generate() {
global $alpha, $output;
for ($i=1; $i < 10 ; $i++) {
//Generates first random letter or number from the array
$first = array_rand($alpha);
$get_one = $alpha[$first];
//Generates second random letter or number from the array
$sec = array_rand($alpha);
$get_two = $alpha[$sec];
//Generates third random letter or number from the array
$thrd = array_rand($alpha);
$get_three = $alpha[$thrd];
//Generates fourth random letter or number from the array
$fth = array_rand($alpha);
$get_four = $alpha[$fth];
//Generates fifth random letter or number from the array
$ffth = array_rand($alpha);
$get_five = $alpha[$ffth];
//Generates sixth random letter or number from the array
$sxth = array_rand($alpha);
$get_six = $alpha[$sxth];
//Stores the output of all the random generated letter into a combined form (In the array $output)
$output = $get_one . $get_two . $get_three . $get_four . $get_five . $get_six . "\n";
}
}
echo '<b>Your Generated Passwords Are:</b>';
//Generates random passwords many time (Depends upon the length of the Array list)
for ($i=0; $i < count($alpha) ; $i++) {
generate();
echo "<li>$output</li>";
}
?>The output of the script is like this:
![[Image: MFTVlWm.png]](http://i.imgur.com/MFTVlWm.png)
If you want to increase the length of your password add those lines to your needs in the generator function:
PHP Code:
$letter_no = array_rand($alpha);
$get_letter_no = $alpha[$letter_no];
To increase password strength or make it looks less familiar add more letters, symbols, numbers and combos to the array.
Have fun

Regards,
Exo94




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
![[Image: IRlys.png]](http://i.imgur.com/IRlys.png)