Looks good, although I have one thought to throw in...

At 05:47 PM 7/10/00 -0400, you wrote:
<sniped>

><!--- Can convert multiple IP's using large dim arrays?? *shrug* --->
><CFLOOP LIST="#ipAddress1#" DELIMITERS="." INDEX="i">
>         <CFSET ipAddress1Arr[loopCnt] = i>
>         <CFSET loopCnt = loopCnt + 1>
></CFLOOP>
>
>
><CFSET ipDotted = ipAddress1>
><CFSET ipBinary =
>(ipAddress1Arr[1]*16777216)+(ipAddress1Arr[2]*65536)+(ipAddress1Arr[3]*256)+
>ipAddress1Arr[4]>

If you've already got the variable loopCnt, then you don't need to make any 
assumptions when creating the variable ipBinary.  Right now, you assume its 
IPv4.  As has already been stated in this thread, what about IPv6?  If we 
pass a delimiter variable and then use the loopCnt variable for ipBinary, 
we don't need to make those assumptions, it should work for IPv4 and v6.  I 
think that ipBinary becomes something like:

<cfloop index="powerCnt" from="loopCnt-1" to="0" step="-1">
         <cfset ipBinary = ipBinary + (ipAddress1Arr[loopCnt]*256^powerCnt)>
</cfloop>

I assume that CF uses sensible order of operations and such for 
this.  Might have to throw in some parentheses or cfsets or somesuch to get 
the code to execute properly.

Enjoy.

Judah


------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to