Getting users IP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

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:

sleepingdanny
New php-forum User
New php-forum User
Posts: 13
Joined: Mon Mar 17, 2003 6:38 am

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"]

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

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.

sigix
php-forum Active User
php-forum Active User
Posts: 364
Joined: Mon Jul 14, 2003 9:39 pm
Location: /Earth/Xion

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() )

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

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

ive used $_SERVER['remote_addr']; and that does the job great thanks!


Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

cron