Hi,

I am trying to display a image telling people to join my site. If you are not logged in, you should see this image. Once you log in the image should not be there.

I want to know what is the correct synax to display the image if I was writing this code in html in a .php page.

Or is the the best way to do it?

Thanks jb

1 answer

2
points
This was chosen as the best answer

That will depend on how your website handles 'logged-in' users. Let's just assume there is a boolean switch in your back-end, called "isUserLoggedIn", whose value changes depending on whether a user is logged in. If a user is signed in, the value is true; if the user is not signed in, the value is false. Your PHP could look something like this:

<?php if (!$isUserLoggedIn) { ?>
<img src="myImageToShowToGuests.gif" alt="Hello Guest!" />
<?php } ?>

Answered almost 8 years ago by Justin Ryan