Bebopgeo Posted December 24, 2009 Share Posted December 24, 2009 Can anyone change this ASP function to PHP function so I can generate a random number or password <%Dim firstNumber, firstLower, firstUpper, firstOther, latterNumber, _latterLower, latterUpper, latterOther, passwordLength, extraChars firstNumber = "true"firstLower = "false"firstUpper = "true"firstOther = "false"latterNumber = "true"latterLower = "false"latterUpper = "true"latterOther = "false"passwordLength = 5extraChars = ""Function getRandomNum(lbound, ubound) For j = 1 To (250 - ubound) Randomize getRandomNum = Int(((ubound - lbound) * Rnd) + 1)Next End FunctionFunction getRandomChar(number, lower, upper, other, extra) numberChars = "0123456789"lowerChars = "abcdefghijklmnopqrstuvwxyz"upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"otherChars = "`~!@#$%^&*()-_=+[{]}\\|;:"""'\,<.>/? "charSet = extra if (number = "true") Then charSet = charSet + numberChars if (lower = "true") Then charSet = charSet + lowerChars if (upper = "true") Then charSet = charSet + upperChars if (other = "true") Then charSet = charSet + otherCharsjmi = Len(charSet) getRandomChar = Mid(charSet, getRandomNum(1, jmi), 1)End FunctionFunction getPassword(length, extraChars, firstNumber, firstLower, _firstUpper, firstOther, latterNumber, latterLower, latterUpper, latterOther)rc = "" If (length > 0) Then rc = rc + getRandomChar(firstNumber, firstLower, firstUpper, firstOther, extraChars) End If For idx = 1 To length - 1 rc = rc + getRandomChar(latterNumber, latterLower, latterUpper, latterOther, extraChars) NextgetPassword = rcEnd FunctionstrUltraPass = getPassword(passwordLength, extraChars, _firstNumber, firstLower, firstUpper, firstOther, _latterNumber, latterLower, latterUpper, latterOther)%><%Session("svPassword") = strUltraPass%> and I use a hiddenfield to insert it into my mysql database <%= Session("svPassword") %> Link to comment Share on other sites More sharing options...
djp1988 Posted December 24, 2009 Share Posted December 24, 2009 Looking for free workers ? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 28, 2009 Share Posted December 28, 2009 There are several PHP scripts to generate random passwords, unless you're looking for something specific which that code does.http://www.google.com/search?client=opera&...-8&oe=utf-8 Link to comment Share on other sites More sharing options...
Bebopgeo Posted December 28, 2009 Author Share Posted December 28, 2009 Thinks that came from a ASP dreamweaver server behavior I was hoping I could fine one for PHP but I will look at them other and mybe I can make one of them work. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.