Hit Counter

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
User avatar
snpo123
Forum Commoner
Posts: 77
Joined: Sat Apr 17, 2004 6:31 pm

Hit Counter

Post by snpo123 »

Okay, so....
I want to make a PHP script that gets the IP address of the person viewing the site and stores it in a database. Do I need to Install an extra plug-in?
Thanks very much.
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 »

nope

Code: Select all

$_SERVER['REMOTE_ADDR'];//will return the ip of the person viewing the page
good luck
User avatar
HaVoC
Forum Commoner
Posts: 83
Joined: Sat Feb 07, 2004 7:20 am
Location: Smiths Falls, CA

Post by HaVoC »

Code: Select all

getenv("REMOTE_ADDR");
I find this one works better
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

they both will work

as for performance wise, I didnt see a difference in either or

I use $_SERVER['REMOTE_ADDR']; myself
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 »

i got curious and i checked execution time for both of them....
gosh i have too much time....
on my local server $_SERVER['REMOTE_ADDR'] was 0.00008 seconds slower then getenv()

do with this what you may....
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

lol, what possible can you do in 0.00008 seconds ?

can u even blink that quick, $_SERVER['REMOTE_ADDR'] is faster to type n looks better

in my opinion, of course.

:wink:
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 »

thats what i was getting at....who gives a damn?!?!?
User avatar
snpo123
Forum Commoner
Posts: 77
Joined: Sat Apr 17, 2004 6:31 pm

Post by snpo123 »

thanks for the help, ill choose which one to use later!
Post Reply