Log in

View Full Version : $_SERVER['REMOTE_ADDR'], << need help with!



hmsnacker123
07-04-2008, 09:39 PM
Hi, on my webpage i have a guestbook, and i have this code:



<?php
function ip() {
$ip = split('[.]', $_SERVER['REMOTE_ADDR']);
echo 'IP: '.$ip[0].'.'.$ip[1].'.x.x';
}
?>


so it outputs as:

123.456.x.x ( not revealing the whole i.p ;) ),

but my problem is that it only shows your ip on every post!, an i was wondering how would show the indivual user ip's, thanks for any help i get.

thetestingsite
07-04-2008, 10:06 PM
you would need to save the ip address in the db when the user posts, then call that column from the db into the split function.

Hope this helps.