Heh heh.... That reminds me of Taz's P.A.S.S.W.O.R.D generator that got posted a while 
back.... (except yours really works)

Getting back on to the random string thing...

If you use a random string for an activiation key make sure you either make sure that 
the string hasn't been used before or ensure that there is a unique identifier that 
goes with the activation key.

Depending on whether you care how long the activation code is and if you're providing 
a URL in an email for the user to click on, you could always just use CreateUUID()

Having said that, if you decide to go this way, run a quick bit of code to make sure 
that CreateUUID isn't generating sequential numbers.  In older versions of CF on some 
operating systems CreateUUID generated sequential numbers.  (Don't ask me which cos I 
can't remember ;o) )
This would make a bit of a security flaw in terms of activiation codes, because an 
unscrupulous "user" could guess other people's activation codes.

<cfloop from="1" to="20" index="i">
<cfoutput>#CreateUUID()#</cfoutput>
</cfloop>

Will give you 20 UUIDs and you'll immediately be able to see if they are generated 
sequentially or not.

Regards

Stephen
---- Message from "Steve Martin" <[EMAIL PROTECTED]> at 14:40:47 2003-07-17 ------
>And here's another one that I prepared earlier:
>
><cfscript>
>
>function getRandChar() {
>       // Set the lower & upper ASCII limits
>       low = 48;
>       high = 122;
>       randCharAsc = randrange(low,high);
>       // constrain to alphanumerics by excluding certain ranges
>       if ((randCharAsc gte 58 and randCharAsc lte 64) or (randCharAsc gte 91 and 
> randCharAsc lte 96))
>               // Hey look kids, recursion
>               randChar = getRandChar();
>       else
>               randChar = Chr(randCharAsc);
>       return randChar;
>}
>
>function randPassword( length ) {
>       pwd = "";
>       for(i=1;i lte length;i=i+1) {
>               pwd = pwd & getRandChar();
>       }
>       return pwd;
>}
>
></cfscript>
>
><cfoutput>#randPassword(6)#</cfoutput>
>
>Steve
>
>> -----Original Message-----
>> From: Kevin Faulkner [mailto:[EMAIL PROTECTED]
>> Sent: 17 July 2003 14:35
>> To: '[EMAIL PROTECTED]'
>> Subject: RE: [ cf-dev ] Creating a random string
>> 
>> 
>> here you go; just specify what you want in the string. It 
>> helps prevent
>> confusion between i and I and 1 for example....
>> 
>> <CFSET uniqueKey="">
>> <CFSET keyLength=10>
>> <CFSET theString="234567890ABCDEFGHJKLMNOPQRSTUVWXYZ">
>> 
>> <CFLOOP from="1" to="#keyLength#" index="loop">
>>   <CFSET uniqueKey = #uniqueKey# &
>> #MID(theString,RANDRANGE(1,LEN(theString)),1)#>
>> </CFLOOP>
>> 
>> <CFOUTPUT>
>> #uniqueKey#
>> </CFOUTPUT>
>> 
>> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: 17 July 2003 14:30
>> To: [EMAIL PROTECTED]
>> Subject: [ cf-dev ] Creating a random string
>> 
>> 
>> Does anyone have any code to hand that will create a random 
>> string for the
>> use as an activation code which will be emailed to users when 
>> they sign up
>> to my web site.
>> 
>> Cheers,
>> 
>> Chris
>> 
>> British Telecommunications plc
>> Registered office: 81 Newgate Street London EC1A 7AJ
>> Registered in England no. 1800000
>> This electronic message contains information from British 
>> Telecommunications
>> plc which may be privileged or confidential. The information 
>> is intended to
>> be for the use of the individual(s) or entity named above. If 
>> you are not
>> the intended recipient be aware that any disclosure, copying, 
>> distribution
>> or use of the contents of this information is prohibited. If you have
>> received this electronic message in error, please notify us 
>> by telephone or
>> email (to the numbers or address above) immediately. 
>> Activity and use of the British Telecommunications plc E-mail 
>> system is
>> monitored to secure its effective operation and for other 
>> lawful business
>> purposes. Communications using this system will also be 
>> monitored and may be
>> recorded to secure effective operation and for other lawful business
>> purposes. 
>> Any views expressed in this email do not reflect those of BT 
>> and any of
>> partners and assosiates. Responsiblity for the opinions 
>> expressed are those
>> of the sender only
>> 
>> -- 
>> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>> 
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> For human help, e-mail: [EMAIL PROTECTED]
>> DISCLAIMER: This e-mail is confidential and may also be 
>> legally privileged.
>> If you are not the intended recipient, use of the information 
>> contained in
>> this e-mail (including disclosure, copying or distribution) 
>> is prohibited
>> and may be unlawful.  Please inform the sender and delete the message
>> immediately from your system.  This e-mail is attributed to 
>> the sender and
>> may not necessarily reflect the views of the patsystems Group 
>> and no member
>> of the patsystems Group accepts any liability for any action taken in
>> reliance on the contents of this e-mail (other than where it 
>> has a legal or
>> regulatory obligation to do so) or for the consequences of 
>> any computer
>> viruses which may have been transmitted by this e-mail. The 
>> patsystems Group
>> comprises patsystems plc and its subsidiary group of companies.
>> 
>> -- 
>> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>> 
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> For human help, e-mail: [EMAIL PROTECTED]
>> 
>> 
>
>--
>** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>For human help, e-mail: [EMAIL PROTECTED]
>



BEGIN:VCARD
VERSION:3.0
PRODID:-//Gordano//NONSGML GLWebMail 7.02.3032//EN
FN:
N:;;;;
EMAIL;TYPE=INTERNET:[EMAIL PROTECTED]
END:VCARD


-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to