View comments | RSS feed

IsLocalHost

Description

Determines whether the specified IP address is the localhost. This supports both IPv4 and IPv6 addresses.

Returns

True, if the IP address is the localhost; False, otherwise.

Category

Decision functions

Function syntax

IsLocalHost(ipaddress)

See also

GetLocalHostIP

History

ColdFusion MX 7 Updater: Added this function.

Parameters

Parameter Description

ipaddress

Valid IP address.

Example

<h3>IsLocalHost Example</h3>

<cfif IsDefined("FORM.theTestIPAddress")>
   <cfif IsLocalHost(FORM.theTestIPAddress)>
      <h3>The IP address <cfoutput>#FORM.theTestIPAddress)#</cfoutput> is the localhost</h3>
   <cfelse>
      <h3>The IP address <cfoutput>#DE(FORM.theTestIPAddress)#</cfoutput> is not the localhost.</h3>
   </cfif>
</cfif>

<form action = "isIPAddressLocalHost.cfm">
<p>Enter an IP address to find out if it is the localhost.
<p><input type = "Text" name = "TheTestIPAddress" value = "127.0.0.1"
<input type = "Submit" value = "Is this the localhost?" name = "">
</form>

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


Ashish-Saxena said on Aug 29, 2007 at 7:52 AM :
To run this example:
(1)Remove extra closing parentheses ‘)’ in first <cfoutput> statement,
(2)Put closing angle bracket ‘>’ in type= “text” statement,
(3)Use method= “post” in <form>.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001832.htm