/    Sign up×
Community /Pin to ProfileBookmark

IP address of visitor to a site

I was just curious, this is probably not even the right forum, does anyone know how to tell what a visitor to your site’s IP address is?

Ian

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@BeachSideJun 27.2005 — [code=php]
$_SERVER['REMOTE_ADDR']
[/code]
Copy linkTweet thisAlerts:
@ffurnaiauthorJun 27.2005 — No kidding? just that simple?

well, let me take it a step further. Do you know how to tell where that IP address came from (geographically I mean)?

I saw a site that lets you input an IP address and it will tell you where that person is (roughly). Not trying to spy, just thought it would be cool "gee whiz" stuff.
Copy linkTweet thisAlerts:
@BeachSideJun 27.2005 — You could try [URL=http://us3.php.net/manual/en/function.gethostbyaddr.php]this[/URL] I never tried it so good luck ?
Copy linkTweet thisAlerts:
@azeriJun 27.2005 — This script shows real IP if visitor is conected trough a proxy too.

<?php

if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {

$ip = $_
SERVER['HTTP_X_FORWARDED_FOR'];

}

elseif (isset($_SERVER['HTTP_VIA'])) {

$ip = $_
SERVER['HTTP_VIA'];

}

elseif (isset($_SERVER['REMOTE_ADDR'])) {

$ip = $_
SERVER['REMOTE_ADDR'];

}

else {

$ip = "unknown";

}

?>
Copy linkTweet thisAlerts:
@chrisliveJun 30.2005 — look up some website statistics scripts.. ive seen a few that will break it down by country etc but from what i remember looking at the code they just had a big array filled with IP ranges
×

Success!

Help @ffurnai spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...