Random password Generator In PHP

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 .You will also get the video of this code in my youtube channel.Happy coding.#sbphptricks.


Comments

Popular posts from this blog

Insert data into database using Android,php & Mysql

How to select data from mysql database using PHP