client IP address

A

Anonymous

Guest
Hi,

How can I get IP address of a client that logged in into my site?

thanks,
webtekie
 
You can use this code: :arrow:

$file="Path To Log File"; #/home/site.com/...
$fp=fopen($file,'a') or die("Couldn't Log!");
fputs($fp,"$REMOTE_ADDR\n");
fclose($fp);

It will open the log file and will add the visitor IP address to it. :p

If you'll do what Andrew suggested you will only see your own IP address. :roll:
 
really? I was under the impression that displayed the IP of that PC... it's used in a browsing counter that I use, and it stores the IP of that clients PC every time.

Andrew
 
sleepingdanny said:
You can use this code: :arrow:

$file="Path To Log File"; #/home/site.com/...
$fp=fopen($file,'a') or die("Couldn't Log!");
fputs($fp,"$REMOTE_ADDR\n");
fclose($fp);

It will open the log file and will add the visitor IP address to it. :p

If you'll do what Andrew suggested you will only see your own IP address. :roll:

$REMOTE_ADDR and $_SERVER['REMOTE_ADDR'] are the same thing. Only thing is $REMOTE_ADDR will only work if register_globals is turned on which is the not so smart way to run a server.
 
Back
Top