how can I know user IP ?? plzz

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
normal
Forum Newbie
Posts: 5
Joined: Sun May 16, 2004 8:07 am

how can I know user IP ?? plzz

Post by normal »

how can I know user IP ?? plzz
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

usually it's stored in the $_SERVER variable..

Code: Select all

$_SERVER['REMOTE_ADDR']
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

What do you plan to do with it?
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

or use

getenv() function with REMOE_ADDR...
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

$_SERVER['REMOTE_ADDR'];
normal
Forum Newbie
Posts: 5
Joined: Sun May 16, 2004 8:07 am

Post by normal »

I wanna count online users !
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

Are you asking how to count online users, or are you just telling?
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

and im intregued to know how your gonna do this with the users ip address
User avatar
mabufo
Forum Commoner
Posts: 81
Joined: Thu Jul 10, 2003 11:11 pm
Location: Orland Park, IL
Contact:

Post by mabufo »

obviously he is going to cast a magical spell on the $_Server variable!

DUH!
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

you know

if I had a cookie for everytime someone asked how to get the IP of their users




i would have alot of cookies

:twisted:

!! use the search function!!
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

tim wrote:you know

if I had a cookie for everytime someone asked how to get the IP of their users




i would have alot of cookies

:twisted:

!! use the search function!!

Code: Select all

setcookie("tasty_cookie","yummy","when_you_eat_it","/","tim");
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

a magical spell.......
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

<?php
setcookie("tasty_cookie","yummy","when_you_eat_it","/","tim");

if (isset($_COOKIE["tasty_cookie"]))
     {
     eatcookie("tasty_cookie","yummy","when_you_eat_it","/","phenom");
     }

?>
Post Reply