Log in

View Full Version : Display page viewers ip script?



samuelb07
04-04-2008, 02:01 PM
Hey! I need a script for my website that displays the viewers IP, any know scripts? I have googled it numerous times.

Blob
04-04-2008, 02:02 PM
<?=$_SERVER["REMOTE_ADDR"]; ?>

iUnknown
04-04-2008, 02:09 PM
<?=$_SERVER["REMOTE_ADDR"]; ?>

Not sure if that displays the IP... probably does though. If I were to do it, I'd do it like this:


<?
$ip = $_SERVER["REMOTE_ADDR"];
echo $ip;
?>

L?KE
04-04-2008, 02:18 PM
Both are correct.

I recommend you Guy's one though ;)



<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo($ip);
?>

samuelb07
04-04-2008, 02:18 PM
Not sure if that displays the IP... probably does though. If I were to do it, I'd do it like this:


<?
$ip = $_SERVER["REMOTE_ADDR"];
echo $ip;
?>

None of these are working, I think you have made that code wrong aswell.

The code should be:[php] <?php
$ip = $_SERVER["REMOTE_ADDR"];
echo $ip;
?>

Any other ways?

L?KE
04-04-2008, 02:20 PM
I used this on one of my sites and works perfectly:



<?php

echo("Your IP address:<br />");
echo($_SERVER['REMOTE_ADDR']);

?>

Blob
04-04-2008, 02:23 PM
Use mine if you have short tags enabled.

samuelb07
04-04-2008, 02:24 PM
I used this on one of my sites and works perfectly:



<?php

echo("Your IP address:<br />");
echo($_SERVER['REMOTE_ADDR']);

?>


Just tried this on my site and it comes up with this where i wanted it:

OMG! :o It's habbMANIA V1! Don't go away! "); echo($_SERVER['REMOTE_ADDR']); ?>

Decode
04-04-2008, 02:30 PM
Just tried this on my site and it comes up with this where i wanted it:

OMG! :o It's habbMANIA V1! Don't go away! "); echo($_SERVER['REMOTE_ADDR']); ?>
Dont use short opening tags




<?php
echo "Your IP Address is:";
echo "($SERVER['REMOTE_ADDR'])";
?>

MrCraig
04-04-2008, 02:37 PM
Orr..

Save bw and just do



<?php
echo($_SERVER["REMOTE_ADDR"]);
?>


...

And is the file extension definately .php?

samuelb07
04-04-2008, 03:09 PM
Fixed :) had to save the file i wanted to include this as .php.

+repping everyone that helped if habbox forum will let me :)

Jme
04-04-2008, 10:47 PM
Do you have php enabled?

Want to hide these adverts? Register an account for free!