SetCookie($_SERVER['REMOTE_ADDR']); ?>
You can use the built-in PHP variable $_SERVER['REMOTE_ADDR'] to check for the IP-address of the user that is accessing the page as shown below:
<? if($_SERVER['REMOTE_ADDR'] == "10.0.1.2") { ?>
... hidden HTML contents ...
}
Below is a section that only is displayed on a computer with a specific IP-address:
This hidden HTML section is only displayed on a computer with the IP-address that is entered in the PHP if statement
if($_SERVER['REMOTE_ADDR'] == " echo($_SERVER['REMOTE_ADDR']); ?>")
in the source of this page.
If you want to see the hidden section that is only available for a computer with a specific IP-address (displayed in red color above the horizontal line) you can open this HTML page in PageSpinner and change the IP-adress in the line
if($_SERVER['REMOTE_ADDR'] == "10.0.1.2")
to your own IP-adress:
echo($_SERVER['REMOTE_ADDR']); ?>
(also available in the System Preferences Network section).
Please note that you may often use the local host address 127.0.0.1 when you are accessing pages on your local Web server, but that you will have a different IP-address when accessing pages on a remote server.
This PHP code example is copyright © 2002-2003 Optima System. All rights reserved worldwide. Unauthorized distribution prohibited. SpinPHP™ User License.