[thelist] ASP Equivalent for CreateUUID() ?
Chris Evans
chris at fuseware.com
Tue Apr 3 09:50:45 CDT 2001
Here's the code I use to create UIDS:
<!--- Covert the IP address to dotless formation. --->
<CFSET numDotless = 0>
<CFSET lstOctets = ListLen(CGI.REMOTE_ADDR,".")>
<CFLOOP From="1" To="#lstOctets#" Index="i">
<CFSET numDotless=numDotless + (ListGetAt(CGI.REMOTE_ADDR,i,".") * (256 ^
(lstOctets-i)))>
</cfloop>
<!--- Create the datetime portion of our ID --->
<CFSET dteEpoch=CreateDateTime("1970","01","01","00","00","00")>
<CFSET dteUnixTime=DateDiff("s", dteEpoch, Now())>
<!--- Seed our randomizer, and get our random number--->
<CFSET tmp = Randomize(Right(GetTickCount(),4))>
<CFSET numRand = RandRange(1, 999999)>
<!--- Create the Global Unique Identifier. --->
<CFSET strUID = numDotless & ":" & dteUnixTime & ":" & numRand>
<CFTRY>
<!--- Set the cookie --->
<cfcookie name="UID" value="#strUID#" expires="NEVER"
domain="#Request.strDomain#" path="/">
<CFCATCH />
</CFTRY>
re: your second question, we connect over SMTP to the MTA. I was creating
an extension to write directly to the MTA spool directory, but couldn't come
up with a common format for the messages. Allof the different mail programs
on NT use a different format, it seems.
Chris Evans
chris at fuseware.com
http://www.fuseware.com
More information about the thelist
mailing list