CFLib.org – Common Function Library Project

IP4r(ip4)

Last updated November 18, 2004
Download UDF

author

Scott Glassbrook                                  Scott Glassbrook

Version: 2 | Requires: ColdFusion 5 | Library: NetLib

Description:
IP4R Takes a common IP address (like 192.168.0.1) and converts it to it's IP4r equivalent. (in this case, it'd be 1.0.168.192) This is used by mack DNS based black lists, and mail server software to check DNS based black lists.

Return Values:
Returns a string.

Example:

<cfscript>
variables.ip_to_convert = '192.168.0.1';
writeoutput("The IP4r of " & variables.ip_to_convert & " is " & ip4r(variables.ip_to_convert));
</cfscript>

Parameters:

Name Description Required
ip4 IP address. Yes

Full UDF Source:

<cfscript>
/**
* IP4r converts standard dotted IP addresses to their reversed IP4r equivalent.
*
* @param ip4      IP address. (Required)
* @return Returns a string.
* @author Scott Glassbrook (cflib@vox.phydiux.com)
* @version 2, November 18, 2004
*/

function ip4r(ip4) {
    return ReReplaceNoCase(ip4, "([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3}).([0-9]{1,3})", "\4.\3.\2.\1");
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
2 day(s) ago

Raymond Compton Raymond Compton added
structBlend
23 day(s) ago

Duncan Duncan added
IsZIPUK
23 day(s) ago

Todd Sharp Todd Sharp added
getTagContentAll
29 day(s) ago

Gerald Guido Gerald Guido added
ListReturnDuplicat...
1 month(s) ago

Created by Raymond Camden / Design by Justin Johnson