I want to get the ip of the visiter at my site. Is there any special function or syntax to get the visitor ip. Plz help mee.
<?php echo "IP: " . $_SERVER['REMOTE_ADDR'] ."<br />\n"; echo "Host: " . gethostbyaddr($_SERVER['REMOTE_ADDR']); ?> PHP:
Note, however, that the IP address cannot be relied on for anything. Using a rudimentary web proxy will mask the true IP, as will using something like TOR. Similarly, if behind a firewall, it will be the firewall's ip you see. Which means you can get multiple visitors with the same IP. However, if all you wish to do is count the unique visitors, or stuff like track their progress through your site it is reasonably good enough.
Yes, but "transparent" being the operative word. It's a voluntary thing to code the forwarded_for headers and anyone trying to avoid detection still will.