Password is widely used in computer as a security mechanism
so we must make a password in such a manner which cannot be guessable by any one. Mostly peoples make
password pattern related to their life i.e. date of birth,city name,address or
something like that which can be guess easily. So we must stop this practice, A strong password
may be difficult to guess.
A strong password comprises special character, numeric,
small and capital case character combination that restricts hacker to guess it.
So I am representing coding that generate password automatically in strong
form. You can use my coding if you want to generate password automatically.
<?php
$msg="";
function makeRandomString ($length=8)
{
$chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ
RSTUVWXYZ0123456789!%,-:;@_{}~";
for ($i = 0, $makepass = '', $len =
strlen($chars); $i < $length;
$i++) $makepass .= $chars[mt_rand(0,
$len-1)];
return $makepass;
}
if(isset($_POST['pass']))
$msg=makeRandomString(10);
?>
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form
action="<?php echo $_SERVER['PHP_SELF']?>"
method="post" >
<input type="submit"
value="Get password" name="pass" />
<h1><?php echo $msg;?></h1>
</form>
</body>
</html>
No comments:
Post a Comment