Logging IP Address

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
ce18
Forum Newbie
Posts: 2
Joined: Fri Feb 27, 2004 7:32 pm

Post by ce18 »

how do u log someones ip address when they visit your site

pleez reply

i need a php snippet

:mrgreen:
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

ce18 wrote:how do u log someones ip address when they visit your site

pleez reply

i need a php snippet

:mrgreen:
Why do you want to do that?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

A generic version:

//edit: yeah nvm, the prupose it seems he wants to log ips is for no good.
ce18
Forum Newbie
Posts: 2
Joined: Fri Feb 27, 2004 7:32 pm

Post by ce18 »

im sorta trying 2 learn here

i want to kno how 2 send the ip with the mail

i already know how 2 send an automatic mail, i just dont know how to send the ip address with it

please help all you nice people out there
User avatar
redhair
Forum Contributor
Posts: 300
Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:

Post by redhair »

ce18 wrote:im sorta trying 2 learn here

i want to kno how 2 send the ip with the mail

i already know how 2 send an automatic mail, i just dont know how to send the ip address with it

please help all you nice people out there
Can ya'll tell me how 2 connect the IP to my Troll-O-Meter :?:
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

hey guys, ce18 is only 13, stop being so paranoid! :)

Anyways craig, ip address is stored in the $_SERVER super global

Code: Select all

<?php

// Assign the ip address to a var called ip
$ip = $_SERVER["REMOTE_ADDR"];

// Display IP address
print "IP Address - " . $ip;

?>
We all have to start somewhere :D

goodluck
Post Reply