Jump to content

Can Anyone Change This Asp Function To Php Function


Bebopgeo

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...