Login Register






[PHP] Random Password Generator filter_list
Author
Message
[PHP] Random Password Generator #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.

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]

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 Smile
Regards,
Exo94
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

[PHP] Random Password Generator #2
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.

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]

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 Smile
Regards,
Exo94
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [PHP] Random Password Generator #3
Heh, nice one. Thanks for sharing man ! Biggrin
[Image: IRlys.png]

Reply

RE: [PHP] Random Password Generator #4
Heh, nice one. Thanks for sharing man ! Biggrin
[Image: IRlys.png]

Reply

RE: [PHP] Random Password Generator #5
(02-11-2013, 07:34 PM)LiXon Wrote: Heh, nice one. Thanks for sharing man ! Biggrin

Glad you liked mate Smile
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [PHP] Random Password Generator #6
(02-11-2013, 07:34 PM)LiXon Wrote: Heh, nice one. Thanks for sharing man ! Biggrin

Glad you liked mate Smile
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply

RE: [PHP] Random Password Generator #7
There's a lot of things wrong with your code:
1- you start the php parser then send html right away, then start the php parser again(not to mention the wrong use of tags)
2- output is defined as an array, but is used as a string
3- way too much unnecessary variables, you can just connect the random chars and store in a variable
4- more but too lazy to sum more up

I bet you can create the same output with less than 10 lines, if you want me to I can recode your app and make it way faster, so you might learn something. No offense btw.

Reply

RE: [PHP] Random Password Generator #8
(02-15-2013, 06:19 PM)zomgwtfbbq Wrote: There's a lot of things wrong with your code:
1- you start the php parser then send html right away, then start the php parser again(not to mention the wrong use of tags)
2- output is defined as an array, but is used as a string
3- way too much unnecessary variables, you can just connect the random chars and store in a variable
4- more but too lazy to sum more up

I bet you can create the same output with less than 10 lines, if you want me to I can recode your app and make it way faster, so you might learn something. No offense btw.
PHP Code:
<?php function Pass($iChars=8,$sCharset="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"){ $iCharset = strlen($sCharset); $sPass = ""; for($x=0;$x<intval($iChars);$x++){ $sPass .= $sCharset[mt_rand(0,($iCharset-1))]; } return($sPass); } echo Pass(); ?>

Reply

RE: [PHP] Random Password Generator #9
(02-15-2013, 09:35 PM)zomgwtfbbq Wrote:
(02-15-2013, 06:19 PM)zomgwtfbbq Wrote: There's a lot of things wrong with your code:
1- you start the php parser then send html right away, then start the php parser again(not to mention the wrong use of tags)
2- output is defined as an array, but is used as a string
3- way too much unnecessary variables, you can just connect the random chars and store in a variable
4- more but too lazy to sum more up

I bet you can create the same output with less than 10 lines, if you want me to I can recode your app and make it way faster, so you might learn something. No offense btw.
PHP Code:
<?php function Pass($iChars=8,$sCharset="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"){ $iCharset = strlen($sCharset); $sPass = ""; for($x=0;$x<intval($iChars);$x++){ $sPass .= $sCharset[mt_rand(0,($iCharset-1))]; } return($sPass); } echo Pass(); ?>
None Taken, I'm just a beginner Smile
My Blog: http://www.procurity.wordpress.com
Donations: 1HLjiSbnWMpeQU46eUVCrYdbkrtduX7snG

Reply