We've moved!
Host4Post has shifted over to an SSD VPS, to speed up your site. If you're seeing this message, then you're seeing the new server on any domain that is pointed to our nameservers.


Thread Closed 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
php random password generator
Author Message
opmin Offline
Registered

Junior Member
42
Posts:
Jan 2012
Joined:
0
Reputation:
Thanks: 0
Given 0 thank(s) in 0 post(s)
Post: #1
php random password generator

PHP random password generator

PHP password generator is a complete, working random password generation function for PHP. It allows the developer to customize the password: set its length and strength. Just include this function anywhere in your code and then use it.

Source code for password.php

Code:
<?php
function generatePassword($
length=9, $strength=0) {
$vowels = 'aeuy';
$consonants =
'bdghjmnpqrstvz';
if ($strength & 1) {
$
consonants .=
'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .=
"AEUY";
}
if ($strength & 4) {
$
consonants .= '23456789';
}
if ($strength & 8) {
$
consonants .= '@#$%';
}
$password = '';
$alt = time() % 2;
for ($i = 0; $i < $
length; $i++) {
if ($alt ==
1) {
$
password .= $consonants[(rand()
% strlen($consonants))];
$
alt = 0;
} else {
$
password .= $vowels[(rand() %
strlen($vowels))];
$
alt = 1;
}
}
return $password;
}
?>
01-25-2012 01:34 AM
Find all posts by this user
opmin Offline
Registered

Junior Member
42
Posts:
Jan 2012
Joined:
0
Reputation:
Thanks: 0
Given 0 thank(s) in 0 post(s)
Post: #2
php random password generator

its just an example, you can make it better.
01-29-2012 03:39 PM
Find all posts by this user
Geek Cohen Offline
Retired Staff

Retired Staff Member
9,257
Posts:
Jul 2009
Joined:
0
Reputation:
Thanks: 0
Given 0 thank(s) in 0 post(s)
Post: #3
php random password generator

[info]This thread is starting to get a lot of crappy replies. It is a great thread, so I'll make this thread a sticky and close it.[/info]

[success]Sticky Thread[/success]

[error]Thread closed[/error]
03-23-2012 10:16 AM
Visit this user's website Find all posts by this user
Thread Closed 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)