Coder Profile - Show off your skills, get a coder profile.
 
 
 
The Author
Helbom
Ole
Send A Message
Rating
Not
Rated
Please login to rate source codes.

Click here to register a free account with us.
General Details
PHP (Hypertext Preprocess...
Posted 1.96 Year Ago
713 Views
Received 0 Ratings
More Codes By This Author
Flexible password generat...

Flexible password generator


Description
Complete password generator that fits everyone. It can return autmaticly generated passwords in lowercase, uppercase, mixed lower and uppercase, numbers and a mix of all.

Leave it with no arguments to use default setup which is a mix between lowercase, uppercase and digits. And a length of 10 characters.

Usage: $mypass = make_password();
Source Code
Comments
Please login to post comments.
 
Helbom     Posted 1.96 Year Ago
 
 
hmm indeed some interesting reading you got there :) thanks for the comment,
i'll be looking into the things you mentioned ;)
 
VBAssassin     Posted 1.96 Year Ago
 
 
Not bad ;-)

My only improvement would be that you add $output = false at the start, then at the
end just before the return add if ($output === false) { trigger_error('Something
went wrong since a password could not be generated.', E_USER_WARNING); }

Then you can easily test to make sure a password was generated by doing using ===
false ;-)

The next level up would be to use OOP... then you could use constants to set
letters, and add your own character set:

$password = new password();
$password->set_charset('0123456789abcdef'); //hex ;-)

or

$password->set_charset(password::CHARSET_HEX); //hex again, but this time using
a constant so you cant accidentally miss a character ;-)

also, if you use the STD library you can implement the array interface allowing you
to manipulate the generated password like an array:

count($password);

//get the first character
print $password[0];

Have fun.

Kind regards,
Scott
Page 1 of 1
More "PHP (Hypertext Preprocessor)" Source Codes By This Author
Recently Posted "PHP (Hypertext Preprocessor)" Source Codes
Recently Rated "PHP (Hypertext Preprocessor)" Source Codes
 
 
Latest News About Coder Profile
Coder Profile Poll
If you made money from keeping your profile up to date, say $30 and up, per month. What extra time would you spend on your profile?

No extra time
A few hours at weekends
A whole day each week
Every minute i can get free


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.20 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved