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
ce18
Forum Newbie
Posts: 2 Joined: Fri Feb 27, 2004 7:32 pm
Post
by ce18 » Fri Feb 27, 2004 7:32 pm
how do u log someones ip address when they visit your site
pleez reply
i need a php snippet
McGruff
DevNet Master
Posts: 2893 Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland
Post
by McGruff » Fri Feb 27, 2004 7:36 pm
ce18 wrote: how do u log someones ip address when they visit your site
pleez reply
i need a php snippet
Why do you want to do that?
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Fri Feb 27, 2004 7:42 pm
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 » Sat Feb 28, 2004 5:45 am
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
redhair
Forum Contributor
Posts: 300 Joined: Fri May 30, 2003 4:36 pm
Location: 53.23N-6.57E
Contact:
Post
by redhair » Sat Feb 28, 2004 7:30 am
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
werlop
Forum Commoner
Posts: 68 Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null
Post
by werlop » Thu Mar 04, 2004 12:34 pm
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
goodluck