The session is starting on the log in page - so on that one it just has to show LogIn initially. That goes to a log in page, and that's where the session starts - and the username is then echoing as it should.
I did have a typo tho :
echo '<a href="logout.php>">Log Out</a>';
But changed :
?php
if(($_SESSION["MM_username"])) {
echo '<a href="logout.php">Log Out</a>';
} else {
echo '<a href="login.php">Log In</a>';
}
?>
to
<?php
if (isset($_SESSION['MM_Username']))
echo '<a href="loggingout.php">Log Out</a>';
else
echo '<a href="login.php">Log In</a>';
?>
The problem I then had was with the log out script, as DW was generating the script and the line for the link around that code, ie :
<a href="<?php echo $logoutAction ?>">
and
</a>
But I couldn't figure out how to incorporate that into the if statement.
As a workaround I've created it on the logout.php page, and set it to log out when the page loads, rather than on the click of a link.
So effectively instead of
Click link > log out > goto logout.php
Its
Click link > goto logout.php > log out > goto loggedout.php
Which seems to work.