0

I use a PHP like this a lot to let me see messages to myself when viewing my sites locally...

switch(PHP_OS)
{
 case 'Linux':
 break;
 default:
 echo 'This message displays locally only.';
 break;
}

I just wondered if there's some script or trick I can use to let me see messages ONLINE that others can't see. For example, I might visit mysite/topics/buffalo and see a message like this:

switch($User)
{
 case 'Me':
 echo 'All the ungulate pages include master/ungulates.php';
 break;
 default:
 // Only the webmaster can see this message.
 break;
}

In fact, I know of one trick that would work. I could simply use the CSS style display: none to render a message invisible but use a different CSS style locally to render it invisible. However, that's a little sloppy, because the content would still be visible in the HTML.

  • [This](http://stackoverflow.com/questions/2053245/how-can-i-detect-if-the-user-is-on-localhost-in-php) might be what you're looking for. – Gary Mar 22 '16 at 00:27
  • That looks interesting. I'll give it a try. –  Mar 22 '16 at 00:35

1 Answers1

0

if you have a login procedure on that site, you can simply do an

if($user == "me_myself") {
  echo "<p>my personal comment</p>";
}
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • DUH...why didn't I think of that when I learned how to make a login script just recently? ;) –  Mar 22 '16 at 00:36