/    Sign up×
Community /Pin to ProfileBookmark

Real IP Address

Hey,
I was going to use $_SERVER[‘REMOTE_ADDR’] to get the IP address but when I tested it on me, it returned 127.0.0.1? Isn’t that the return IP? Is it because I have a router? What can I do to make it return the true IP?
THanks

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 30.2005 — Were you testing locally on your PC? If so, that address is probably valid (you're not actually going out to the internet). If you run it on a webserver on the internet, you should then see your internet IP address.
Copy linkTweet thisAlerts:
@sftrprodauthorDec 30.2005 — Oh yeah. That makes sense. Sorry, I'm just not thinking proparly. ? Thanks
Copy linkTweet thisAlerts:
@sftrprodauthorDec 30.2005 — Ok, I went to an "what's my IP" style website and it returned the following:

Your IP Is 81.96.255.163

Proxy Detected Is 82.3.32.73

Which would I enter into the database to simulate me signing in from the outside? Also, could you tell me the difference between the two? I believe the first one is just the standard IP for a router, because when I put it into Firefox it comes up with my Router page.
Copy linkTweet thisAlerts:
@CytaelDec 31.2005 — go to www.whatismyip.com -- that will give you the proper external IP to use

whichever that page returns is your IP address as the internet sees it, the other is most likely an address used to distinguish between computers on your local network.
Copy linkTweet thisAlerts:
@pratik_learnerDec 31.2005 — Hey gotta q? If ip's of dialup users are not static that means logging their IP's ( eg in polls and such scripts) may be useless. And is the MAC address present for all devices accessing the internet and furthermore is it unqiue for all of them
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYDec 31.2005 — how do you get the MAC address?
Copy linkTweet thisAlerts:
@SpectreReturnsDec 31.2005 — You mac address is unique, but unaccessable.
Copy linkTweet thisAlerts:
@ShrineDesignsDec 31.2005 — an IP comparison function[code=php]function ip_match($ip1, $ip2)
{
$p = 27;

while($p >= 13)
{
$m = 0xffffffff << (32 - $p--);

if(ip2long($ip1) & $m == ip2long($ip2) & $m)
{
return true;
}
}
return false;
}[/code]
Copy linkTweet thisAlerts:
@Archon_MkIVJan 01.2006 — You'd use cookies, not the IP adress.
Copy linkTweet thisAlerts:
@pratik_learnerJan 01.2006 — OK then how come poll-systems are foolproof if one can delete the cookies or they get deleted every day by a cache cleaning soft. Eh?
Copy linkTweet thisAlerts:
@SpectreReturnsJan 01.2006 — Perhaps they are based on your userid or simply you have a static IP ?
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 01.2006 — OK then how come poll-systems are foolproof if one can delete the cookies or they get deleted every day by a cache cleaning soft. Eh?[/QUOTE]
in those cases you can only vote when you're signed in
Copy linkTweet thisAlerts:
@pratik_learnerJan 01.2006 — Well this makes no sense at all. A poll is something which sits at the site and if very few hardly click on it and then very few of the users(not guests) would do so. So how many votes do you get

the number of votes -> 0
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYJan 01.2006 — if you want a foolproof poll, then you'd have to have your users signed in and somehow verifiy their identity so they can't register many accounts. but who would want to do that..

for example, the petition that you can sign in my sig does only check if the e-mail adress is already in the database, not the IP, or cookies, etc..and it was sufficient to keep most spammers and double signers away. (there was like 2 unintentional double signatures)
×

Success!

Help @sftrprod 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.5,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...