Posts

Showing posts with the label how to generate random password in php

Random password Generator In PHP

Image
In this tutorial you will learn how to create a random password using PHP. This program can be helpful to suggest the users an auto generated random password.In this program we are using substr() method which will use str_shuffle() to create a password of the length which is supplied to the function pass1($len).The password length will be decided by the number which is supplied to the function.The code of the program is as below- <?php function pass1($len) { error_reporting(0); $charset="!@iloveindia%^&"; $password=substr(str_shuffle($charset),0,$len); return $password; } $newpassword=pass1(8); ?> <table> <tr> <td>Password</td> <td><?php echo $newpassword;?></td> <td><input type="button" name="b1" id="b1" value="New Password" onClick="window.location.reload()"/></td> </tr> </table> Copy this code and paste in your .php file...