Private Info on a Public Page
It is possible to see certain information on a public web page, located on your website, that nobody else can see.
One reason to do so would be to view page load counts that are nobody else's business. Another reason can be to see if the page spawns any warning messages. Whatever the reason might be, this article describes a way to do it.
The technique is especially useful when debugging things on the page — a form page or its confirmation page for example.
The method publishes certain content only when the page is accessed with your IP address. Browsers or bots from any other IP address do not see the content, not even in the web page source code.
The web page must be a *.php web page because the method uses PHP code. Here it is.
<?php if($_SERVER['REMOTE_ADDR']=='44.33.222.111'): ?>
[ANY CONTENT]
<?php endif; ?>
Implementation is 3 steps:
-
Paste the above code into your web page where the information shall publish only for your IP address.
-
Replace
44.33.222.111
with your own IP address. (The Get IP Address and User-Agent String page can be used to get your IP address.) -
Replace
[ANY CONTENT]
with the content only you shall see. It may be as little or as much content as you wish.
For website owners, this is a nice tool to have access to.
(This content first appeared in Possibilities newsletter.)
Will Bontrager