Welcome visitor
* Login
* Register
It is currently July 19th, 2019, 2:14 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 3 posts ] 
Author Message
  get visitor ip
PostPosted: September 30th, 2009, 11:42 pm 

Posts: 21
do you know if there's an html or js to find the visitor ip? thanks.


Top
 Profile  
 
  Re: get visitor ip
PostPosted: October 1st, 2009, 1:04 am 
User avatar

Posts: 70
its javascript
var ip = '<!--#echo var="REMOTE_ADDR"-->';

but there might be some crossbrowser issues and the file should have the .shtml extension for the browser to parse it.


Top
 Profile  
 
  Re: get visitor ip
PostPosted: October 6th, 2009, 10:24 pm 
Site Admin
User avatar

Posts: 39
I would suggest using PHP, here is the code you need:

<?php

function GetVisitorRealIP()
{
  $fwd_ip_string = getenv("HTTP_X_FORWARDED_FOR");
  $fwd_ip = "";
  if (StrLen($fwd_ip_string)) {
    $fwd_ip_list = explode("," , $fwd_ip_string);
    $fwd_ip = $fwd_ip_list[0];
  }
return $fwd_ip;
}

if (getenv(HTTP_X_FORWARDED_FOR)){
    $ip=GetVisitorRealIP;
    }
else{
    $ip=getenv(REMOTE_ADDR);
    }

echo $ip;

?>

_________________
I'm not afraid to die. I just don't want to be there when it happens.
- Woody Allen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron