0 Replies - 934 Views - Last Post: 12 June 2007 - 05:18 AM

#1 Chubber  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 131
  • Joined: 16-October 06

MakeCookieID

Posted 12 June 2007 - 05:18 AM

Description: Good for making a reasonably short, pretty unique ID.The CookieID is a 20 character string that is very unique, serial to generate and of 0-9A-Z construction
Function MakeCookieID()
     'The CookieID is a 20 character string that is very unique, serial to generate
     'and of 0-9A-Z construction
     Dim strOut
     'The time, to the second
     strOut = strOut & LeftPad(Hex(DateDiff("s", "1/1/1990", Now())), "0", 8) '8 Digits
     'The users IP
     Dim arrayIP
     arrayIP = Split(Request.ServerVariables("REMOTE_ADDR"), ".", -1)
     strOut = strOut & LeftPad(Hex(arrayIP(0)),"0",2) & LeftPad(Hex(arrayIP(1)),"0",2) & _
               LeftPad(Hex(arrayIP(2)),"0",2) & LeftPad(Hex(arrayIP(3)),"0",2)'8 Digits
     'A random number of exactly 4 hex digits, from 1000 to FFFF
     strOut = strOut & Hex(Int((65535 - 4096 + 1) * Rnd + 4096)) '4 digits
     'That brings us up to 20 digits
     
     MakeCookieID = strOut
End Function


Is This A Good Question/Topic? 0
  • +

Page 1 of 1