twixy2k
02-10-2003, 01:33 PM
hi, I 'm using this to produce a random number in lowercase, 5 charc long. I've tried some hand editing to one thats in dreamweaver but anit working proper.
Thanks
<%
var firstLower,passwordLength,
firstLower = true
latterLower = true
passwordLength = 5
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
function getRandomChar(lower){
var lowerChars = "abcdefghijklmnopqrstuvwxyz";
if (lower == true)
charSet += lowerChars;
return charSet.charAt(getRandomNum(0, charSet.length));
}
function getPassword(length, firstLower, latterLower) {
var rc = "";
if (length > 0)
rc = rc + getRandomChar(firstLower);
for (var idx = 1; idx < length; ++idx) {
rc = rc + getRandomChar(latterLower);
}
return rc;
}
strUltraPass = getPassword(passwordLength, firstLower, latterLower)
%>
<%Session("svuser") = strUltraPass%>
Thanks
<%
var firstLower,passwordLength,
firstLower = true
latterLower = true
passwordLength = 5
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
function getRandomChar(lower){
var lowerChars = "abcdefghijklmnopqrstuvwxyz";
if (lower == true)
charSet += lowerChars;
return charSet.charAt(getRandomNum(0, charSet.length));
}
function getPassword(length, firstLower, latterLower) {
var rc = "";
if (length > 0)
rc = rc + getRandomChar(firstLower);
for (var idx = 1; idx < length; ++idx) {
rc = rc + getRandomChar(latterLower);
}
return rc;
}
strUltraPass = getPassword(passwordLength, firstLower, latterLower)
%>
<%Session("svuser") = strUltraPass%>