This free script provided by
JavaScript
Kit
Free Script from www.javascriptkit.com
<script>
//Random password generator- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use
var keylist="abcdefghijklmnopqrstuvwxyz123456789"
var temp=''
function generatepass(plength){
temp=''
for (i=0;i<plength;i++)
temp+=keylist.charAt(Math.floor(Math.random()*keylist.length))
return temp
}
function populateform(enterlength){
document.pgenerate.output.value=generatepass(enterlength)
}
</script>
<form name="pgenerate">
<input type="text" size=18 name="output">
<input type="button" value="Generate Password" onClick="populateform(this.form.thelength.value)"><br />
<b>Password Length:</b> <input type="text" name="thelength" size=3 value="7">
</form>
<p align="center">This free script provided by<br />
<a href="http://javascriptkit.com">JavaScript
Kit</a></p>
//Random password generator- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use
var keylist="abcdefghijklmnopqrstuvwxyz123456789"
var temp=''
function generatepass(plength){
temp=''
for (i=0;i<plength;i++)
temp+=keylist.charAt(Math.floor(Math.random()*keylist.length))
return temp
}
function populateform(enterlength){
document.pgenerate.output.value=generatepass(enterlength)
}
</script>
<form name="pgenerate">
<input type="text" size=18 name="output">
<input type="button" value="Generate Password" onClick="populateform(this.form.thelength.value)"><br />
<b>Password Length:</b> <input type="text" name="thelength" size=3 value="7">
</form>
<p align="center">This free script provided by<br />
<a href="http://javascriptkit.com">JavaScript
Kit</a></p>
PHP Password Generator Script
// Characters to use for the password
$str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+=_,!@$#*%<>[]{}";
// Desired length of the password
$pwlen = 8;
// Length of the string to take characters from
$len = strlen($str);
// RANDOM.ORG - We are pulling our list of random numbers as a
// single request, instead of iterating over each character individually
$uri = "http://www.random.org/integers/?";
$random = file_get_contents(
$uri ."num=$pwlen&min=0&max=".($len-1)."&col=1&base=10&format=plain&rnd=new"
);
$indexes = explode("\n", $random);
array_pop(&$indexes);
// We now have an array of random indexes which we will use to build our password
$pw = '';
foreach ($indexes as $int){
$pw .= substr($str, $int, 1);
}
$str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-+=_,!@$#*%<>[]{}";
// Desired length of the password
$pwlen = 8;
// Length of the string to take characters from
$len = strlen($str);
// RANDOM.ORG - We are pulling our list of random numbers as a
// single request, instead of iterating over each character individually
$uri = "http://www.random.org/integers/?";
$random = file_get_contents(
$uri ."num=$pwlen&min=0&max=".($len-1)."&col=1&base=10&format=plain&rnd=new"
);
$indexes = explode("\n", $random);
array_pop(&$indexes);
// We now have an array of random indexes which we will use to build our password
$pw = '';
foreach ($indexes as $int){
$pw .= substr($str, $int, 1);
}
Scripts from PHP Password Generator Script
$alpha = "abcdefghijklmnopqrstuvwxyz";
$alpha_upper = strtoupper($alpha);
$numeric = "0123456789";
$special = ".-+=_,!@$#*%<>[]{}";
$chars = "";
if (isset($_POST['length'])){
// if you want a form like above
if (isset($_POST['alpha']) && $_POST['alpha'] == 'on')
$chars .= $alpha;
if (isset($_POST['alpha_upper']) && $_POST['alpha_upper'] == 'on')
$chars .= $alpha_upper;
if (isset($_POST['numeric']) && $_POST['numeric'] == 'on')
$chars .= $numeric;
if (isset($_POST['special']) && $_POST['special'] == 'on')
$chars .= $special;
$length = $_POST['length'];
}else{
// default [a-zA-Z0-9]{9}
$chars = $alpha . $alpha_upper . $numeric;
$length = 9;
}
$len = strlen($chars);
$pw = '';
for ($i=0;$i<$length;$i++)
$pw .= substr($chars, rand(0, $len-1), 1);
// the finished password
$pw = str_shuffle($pw);
$alpha_upper = strtoupper($alpha);
$numeric = "0123456789";
$special = ".-+=_,!@$#*%<>[]{}";
$chars = "";
if (isset($_POST['length'])){
// if you want a form like above
if (isset($_POST['alpha']) && $_POST['alpha'] == 'on')
$chars .= $alpha;
if (isset($_POST['alpha_upper']) && $_POST['alpha_upper'] == 'on')
$chars .= $alpha_upper;
if (isset($_POST['numeric']) && $_POST['numeric'] == 'on')
$chars .= $numeric;
if (isset($_POST['special']) && $_POST['special'] == 'on')
$chars .= $special;
$length = $_POST['length'];
}else{
// default [a-zA-Z0-9]{9}
$chars = $alpha . $alpha_upper . $numeric;
$length = 9;
}
$len = strlen($chars);
$pw = '';
for ($i=0;$i<$length;$i++)
$pw .= substr($chars, rand(0, $len-1), 1);
// the finished password
$pw = str_shuffle($pw);
Subscribe to:
Posts (Atom)