Hi all,
I would like to do some conditional checking in a Flex app based on
Local (not proxy) IP address of the user. I have looked at using the
below:
<cfif #CGI.HTTP_X_Forwarded_For# EQ "">
<cfset ipaddress="#CGI.Remote_Addr#">
<cfelse>
<cfset ipaddress="#CGI.HTTP_X_Forwarded_For#">
</cfif>
<cfreturn ipaddress />
But found on a friend testing within a coorporate environment it
returned unknown, further research discovered that both Remote_Addr &
HTTP_X_Forwarded_For are unrelieable so I dug further and came up with
the below. The query actually returned a binary value which did not
have the typical IP format I am used to (it was something like
98-2342124)? Is this ok do you reckon, any one got any opinions on
this?
<cfcomponent hint="Query IP">
<cffunction name="checkIP" access="remote" returntype="binary"
hint="Return Current User IP">
<cfset ipaddress=CreateObject("java",
"java.net.InetAddress").getLocalHost().getAddress()>
<cfreturn ipaddress />
</cffunction>
</cfcomponent>
Cheers,
Simon
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5428
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37