Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how get the IP of visitor in CFML

New Here ,
Nov 11, 2010 Nov 11, 2010

I want get the IP of visitor in CFML?

823
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 11, 2010 Nov 11, 2010

Hi,

Use #CGI.REMOTE_ADDR#

HTH

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 11, 2010 Nov 11, 2010

<?php function getIP()
{
      if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
      else if (isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
      else $ip = “UNKNOWN”;
      return $ip;
}

$ref=$_SERVER['HTTP_REFERER'];

$userAgent=$_SERVER['HTTP_USER_AGENT']; ?>

also this PHP code how translated in cfml?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 11, 2010 Nov 11, 2010
LATEST

Try this,



<CFIF
#CGI.HTTP_X_Forwarded_For# EQ "">
     <CFSET ipaddress="#CGI.Remote_Addr#">
<CFELSE>
     <CFSET ipaddress="#CGI.HTTP_X_Forwarded_For#">
</CFIF>

<CFSET ref = "#CGI.HTTP REFERER#">
<CFSET userAgent = "#CGI.HTTP_USER_AGENT#">

HTH

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources