Me and a co worker *cough* cam *cough* were discussing
this and it would be a lot easier to write the range
checking code using the array converted to hex.
The InputBaseN tag would work well. Okay ill write
my version of how I would do it :P
Okay here goes some code, forgive the formatting



<!--- I am not gonna do CFSCRIPT but if this
were an actual tag that would be optimal --->

<CFSET ipAddress1 = "192.168.1.5">
<CFSET ipAddress1Arr = ArrayNew(1)>
<CFSET ipAddressBase16 = "">
<CFSET ipBinary = "">
<CFSET loopCnt = 1>

<!--- 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]>
<CFSET ipAddressbase16 = FormatBaseN(ipBinary, 16)>

<CFOUTPUT>
Hex:&nbsp;0x#ipAddressBase16#<BR><BR>
Binary:&nbsp;#ipBinary# <BR><BR>
Dotted Notation:&nbsp;#ipDotted# <BR><BR>
</CFOUTPUT>

<!--- hmmn work this backwords easy easy. for the custom tag.
TYPE="binary"
TYPE="hex"
TYPE="dotted"

setup a case structure for each kind of input.

then output the two differeing conversions
-----
so in TYPE="hex" read two numbers convert it to base 10 assemble
the dotted notation string

and just outright convert hex to base10 and you have the binary formatted
string
--------
in TYPE="binary"
jsut do a conversions to hex and then use the hex reading code
and redo it to dotted notation.
---------
I wrote the conversion to
TYPE="dotted" already :)

I dont feel like palying with Custom tag stuff, anyone else wanna use this
code just stick me on the credits for this :)))
--->

Forgive me in advance if there are any shrotcomings with this
I hacked this up real quick :) Ahh well ive contributed my thoughts :)

Note any of these three forms works in my browser :)



Jeremy






------------------------------------------------------------------------------
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