I am trying to check if a User sessions exist with facebook api.
If someone is logged in I want to show a logout link,
If they are not logged in I want to show a login link.
No matter what it is showing a logout link. I think maybe because the call is not logging the user out?????
Also what is the best practice to verify a session for restricted pages? Should I follow the same concept I am using?
<?php if ($user): ?> // nothing else { redirect to login page?
Here is my code.
<?php if ($user): ?>
<dd><a href="<?php echo $logoutUrl; ?>"><span class="fui-facebook"> </span>Logout</a>
</dd>
<?php else: ?>
<dd><a href="<?php echo $loginUrl; ?>"><span class="fui-facebook"> </span>Sign In with Facebook</a>
</dd>
<?php endif ?>
</dl>
</div>
</div>
</nav>