Friday, 12 September 2014

How to create automatic password using php

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.
                 function makeRandomString ($length=8)
                  $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQ
                  for ($i = 0, $makepass = '', $len = strlen($chars); $i < $length;
                  $i++) $makepass .= $chars[mt_rand(0, $len-1)];
                  return $makepass;
<title>Untitled Document</title>
                <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" >
                <input type="submit" value="Get password" name="pass" />
        <h1><?php echo $msg;?></h1>


1 comment: