Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Getting users IP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Getting users IP

Postby fspilot » Tue Sep 02, 2003 5:06 am

Hi all, me again!

Im trying to write a script that will get some users details, im just wondering how you get the users IP through the PHP script.

Is this possible?

Regards
fspilot
New php-forum User
New php-forum User
 
Posts: 26
Joined: Fri Jun 27, 2003 11:51 am
Location: Bath UK

Postby sigix » Tue Sep 02, 2003 6:37 am

you can know all about this type of stuff with phpinfo() function
and then php variables _SERVER[''] :arrow:
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby sleepingdanny » Tue Sep 02, 2003 7:40 am

If I know currectly - you will not be able to find the IP when
using $_SERVER, am I correct?

Anyway if you want to find out only the IP just use:
$_ENV["REMOTE_ADDR"]
sleepingdanny
New php-forum User
New php-forum User
 
Posts: 13
Joined: Mon Mar 17, 2003 6:38 am

Postby swirlee » Tue Sep 02, 2003 12:32 pm

sleepingdanny wrote:If I know currectly - you will not be able to find the IP when
using $_SERVER, am I correct?


You are not correct. Use $_SERVER['REMOTE_ADDR']. $_ENV is not reliable in this respect.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby sigix » Wed Sep 03, 2003 1:37 am

sleepingdanny wrote:If I know currectly - you will not be able to find the IP when
using $_SERVER, am I correct?



$_SERVER['']
I just gave him the idea to find other things too that can be available instead of only IP
that's why i used $_SERVER[' '] (referenced phpinfo() )
sigix
php-forum Active User
php-forum Active User
 
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

Postby fspilot » Wed Sep 03, 2003 8:48 am

ive used $_SERVER['remote_addr']; and that does the job great thanks!
fspilot
New php-forum User
New php-forum User
 
Posts: 26
Joined: Fri Jun 27, 2003 11:51 am
Location: Bath UK


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.