Zend - The PHP Company




Passwords

Add Code


generate_password  

Type: code fragment
Added by: bmcua
Entered: 19/04/2003
Last modified: 05/12/2002
Rating: - (fewer than 3 votes)
Views: 5143
Password Generator - contains numbers and alphabates.


<?
//*****************************************
// author: Bryan Cua                   
// email: bmcua@hotmail.com        
// website: http://members.lycos.co.uk/dateonline/
// description: Password Generator.
//*****************************************

function generate_password(){
 for(
$i=0$i<8$i++) {
  if(
rand(0,1))
   
$pass[$i] = chr(rand(48,57));
  else
   
$pass[$i] = chr(rand(65,90));
 }
 
shuffle($pass);
 return 
implode("",$pass);
}

// example
$pass generate_password();
echo 
$pass;
?>


Usage Example


$pass = generate_password();
echo $pass;


Rate This Script





Search



This Category All Categories