![]() |
|
PHP Password Generator - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: PHP (https://sinister.li/Forum-PHP) +--- Thread: PHP Password Generator (/Thread-PHP-Password-Generator) |
PHP Password Generator - Slarek - 08-24-2013 Hi! Made this little script as a practice. Code: <?php
function rand_password($len)
{
mt_srand((double)microtime()*1000000^getmypid());
$password='';
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+@#?~'; // Used characters
while(strlen($password)<$len)
$password.=substr($chars,(mt_rand()%strlen($chars)),1);
return $password;
}
$password=rand_password($num);
?>
<html>
<body>
<title> Password Generator </title>
<form method="GET" action="pass.php">
How long password you want:<input type="text" size="60" name="num">
<input type="submit" value="[ ok ]"><br>
</form>
<?php
echo "Generated password: <b>$password</b>";
?>PHP Password Generator - Slarek - 08-24-2013 Hi! Made this little script as a practice. Code: <?php
function rand_password($len)
{
mt_srand((double)microtime()*1000000^getmypid());
$password='';
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+@#?~'; // Used characters
while(strlen($password)<$len)
$password.=substr($chars,(mt_rand()%strlen($chars)),1);
return $password;
}
$password=rand_password($num);
?>
<html>
<body>
<title> Password Generator </title>
<form method="GET" action="pass.php">
How long password you want:<input type="text" size="60" name="num">
<input type="submit" value="[ ok ]"><br>
</form>
<?php
echo "Generated password: <b>$password</b>";
?>RE: PHP Password Generator - walesb - 09-05-2013 Please drop your number ... so we can talk @Slarek RE: PHP Password Generator - invisal - 09-05-2013 (09-05-2013, 04:25 AM)Slarek Wrote:(09-05-2013, 02:53 AM)walesb Wrote: Please drop your number ... so we can talk @Slarek Nice, now you have stalker. How do you feel? RE: PHP Password Generator - Slarek - 09-05-2013 (09-05-2013, 05:11 AM)invisal Wrote:(09-05-2013, 04:25 AM)Slarek Wrote:(09-05-2013, 02:53 AM)walesb Wrote: Please drop your number ... so we can talk @Slarek I feel terrible. RE: PHP Password Generator - Mediocrity_mybb_import6293 - 09-23-2013 Pretty decent, thanks for the share? Reviewing the code it looks rather straightforward to script, I never thought of programming one before. Thanks for the share. RE: PHP Password Generator - Slarek - 09-23-2013 @Mediocrity Indeed. This is very simple script which i made as a practice. But if modify the source, you can make it more efficient. |