/    Sign up×
Community /Pin to ProfileBookmark

can php detech IP address of users?

i want to do a audit trail, and save the IP address users into my database … is there any php functions or statements that allow me to get users IP address?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@Paul_JrMay 13.2004 — You can access it through the [font=courier]REMOTE_ADDR[/font] property of the $_SERVER (or $HTTP_SERVER_VARS) superglobal.

If you are using PHP version 4.1.0 or above, you access it like this:
[code=php]
<?php
echo $_SERVER["REMOTE_ADDR"];
?>
[/code]

But if you are using a version of PHP below 4.1.0, then you access it like this:
[code=php]
<?php
echo $HTTP_SERVER_VARS["REMOTE_ADDR"];
?>
[/code]

You can find some more info [url=http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server]here[/url].
Copy linkTweet thisAlerts:
@ltingauthorMay 13.2004 — thanks it works well ?
Copy linkTweet thisAlerts:
@Paul_JrMay 13.2004 — You&#8217;re welcome. ?
×

Success!

Help @lting 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 6.1,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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