Zend - The PHP Company




Passwords

Add Code


murugesan  

Type: code fragment
Added by: murugesan
Entered: 18/08/2003
Last modified: 08/12/2002
Rating: - (fewer than 3 votes)
Views: 3753
Password generation which has numbers alphabets and underscores.


<?php
function password($min=4,$max=8)

   for(
$i=0$i<rand($min,$max); $i++) 
  { 
     
$choose=rand(0,3);
     if(
$choose==0
        
$pwd[$i] = chr(rand(97,122)); 
     else if(
$choose==1)
        
$pwd[$i] = chr(rand(65,90)); 
     else if (
$choose==2)
       
$pwd[$i] = chr(rand(48,57); 
  } 
 
$passwd password(); 
 echo 
$passwd
?> 
?>


Usage Example




Rate This Script





Search



This Category All Categories