Hey! I need a script for my website that displays the viewers IP, any know scripts? I have googled it numerous times.
Printable View
Hey! I need a script for my website that displays the viewers IP, any know scripts? I have googled it numerous times.
PHP Code:<?=$_SERVER["REMOTE_ADDR"]; ?>
Both are correct.
I recommend you Guy's one though ;)
PHP Code:<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo($ip);
?>
I used this on one of my sites and works perfectly:
PHP Code:<?php
echo("Your IP address:<br />");
echo($_SERVER['REMOTE_ADDR']);
?>
Use mine if you have short tags enabled.
Orr..
Save bw and just do
...PHP Code:<?php
echo($_SERVER["REMOTE_ADDR"]);
?>
And is the file extension definately .php?