Jump to content
xisto Community
Sign in to follow this  

IP Script

Recommended Posts

just copy to a PHP file.

<?php        $ip=@getenv("REMOTE_ADDR");        echo "Your IP is: <B>$ip</B>";?>

To add to HTML:
<Script Language=php>$ip=@getenv("REMOTE_ADDR"); echo "Your IP is: <B>$ip</B>";</script>OR:<?= "Your IP is: <b>".getenv('REMOTE_ADDR')."</b>" ?>
[4 Second option ull have to edit php.ini file]
[Thank You CodeFX]

Share this post

Link to post
Share on other sites

The second way won't work. You can't embed PHP code in a .html document without modifying php.ini, and even then it wouldn't work. Assuming it goes through the parser, which means it is either a .php file or you have edited php.ini, The correct syntax would be:

<script language="php">$ip=@getenv("REMOTE_ADDR");echo "Your IP is: <B>$ip</B>"; </script>

But anyway, thanks. I didn't know how to do that.

P.S. You could also use this statement:
<?= "Your IP is: <b>".getenv('REMOTE_ADDR')."</b>" ?>

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.