jacob's blog

Some IP Parsing Fun Using ColdFusion

I know some of you have been dying for code (yeah, right) so here's a small function I made for parsing an IP address. I needed the last byte to determine if the machine calling the page was a developer's machine or not.

<cfoutput>
<cfset BegPos = 1>
<cfset EndPos = 1>
<cfset ip = #CGI.REMOTE_ADDR#>
<cfset ByteArray = ArrayNew(1)>

<cfloop index="i" from="1" to="4">
<cfset EndPos = #FIND(".", ip, BegPos)#>
<cfif EndPos GT 0>
<cfset ByteArray[i] =

About Jacob

I'm a software developer and database designer from Marysville WA. I have experience with 7 programming languages and am highly skilled in creating both desktop and web-based applications, although my current focus is web-based. I program daily using Coldfusion, PHP, MS SQL and MySQL, and a little AJAX. I absolutely love Linux and anyone fed up with Windows should give Ubuntu a try. I love writing, reading and working out.

Pages

Subscribe to RSS - jacob's blog