You have 2 examples and both have syntax errors:
Parse error: syntax error, unexpected T_ELSE
If you format your code correctly, you found the error:
<?php
if (isset($_SESSION['access_token'])) {
?> <a href="logout.php">Log out</a><?php
} else {
?> <a href="login.php">Log In</a> <?php
}
?>
That:
<?php } ?>
<?php
else
{ ?>
is not valid. The PHP intepreter can't handle this! Please use <?php } else { ?>
The second: Use an Syntax-Highlighted editor! You see that the Syntax is not correct.
Escape the "
in your code, you forgotten the ;
after the echo:
<?php
if(isset($_SESSION['access_token'])) {
echo "<a href=\"logout.php\">Log out</a>";
} else {
echo "<a href=\"login.php\">Log In</a>";
}
?>