RandomHelloACM

Generate random using web service into ASP variable.
With help of PHP, we now have another way to generate random strings, needed to create random ID for most of my web applications
Originally from https://helloacm.com/random/

If you want to prevent it from creating ID starts with zero (like I do), replace RandomHelloACM.php code
 for ($i = 0; $i < $length; $i++) {
  $randomString .= $characters[rand(0, $charactersLength - 1)];
 }
With
 for ($i = 0; $i < $length; $i++) {
  $Char1 = $characters[rand(0, $charactersLength - 1)];
  while ($i == 0 && $Char1 == '0') {
   $Char1 = $characters[rand(0, $charactersLength - 1)];
  }
  $randomString .= $Char1;
 }

CodeFunctionName
What is this?

Public

Tested

Original Work
Function RandomHelloACM(Leng, Upper, Lower, Digits, SpcChars)
' Leng is length of password
' Upper = 1 or 0 to include upper case
' Lower = 1 or 0 for lower case
' Digits = 1 or 0 for numeric digits
' SpcChars = 1 or 0 for special characters
' Attached file is the complete PHP that does generate that random
'
XX = Upper + (Lower * 2) + (Digits * 4) + (SpcChars * 8)
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", SiteNAme & "Assets/RandomHelloACM.php?n=" & Leng & "&x=" & XX, 0
' n = number of characters
' x = bitmask
' 1 = upper case, 2 = lower case, 4 = digist, 8 = special chars
' x = 5 means = 1 + 4 = upper + digits
xmlhttp.send ""
RandomHelloACM = Replace(xmlhttp.responseText, """", "")
Set xmlhttp = Nothing
End Function

Leng, Upper, Lower, Digits, SpcChars

Views 4,698

Downloads 1,526

CodeID
DB ID