I am building my login system for my website, everything is working as intended however I wanted to further design a feature where if the user is logged in, echo their name with a 'Manage' bit of text before it, so ideally they would login, this new button would appear that says Manage | 'Their username'
. I have managed to implement a changing 'logout/login' button so when they are logged in, 'logout' will appear and vice versa in the code below.
login change
<?php if(isset($_SESSION['user_id']) ||
isset($_SESSION['logged in'])){ ?>
<li> <a href="logout.php"> Logout | <?php echo
$_SESSION['user_id'] ?> </a></li>
<?php }else{ ?>
<li> <a href="loginpage.php" >login</a></li>
<?php } ?>
This is at the top of my navbar, I have tried to apply the same principle however the page just becomes unresponsive. After adding and removing code when I only implement this section
<li> <a href="clubpage.php"> Manage | <?php echo $_SESSION['user_id'] ?>
</a></li>
It displays as intended, however then when attempting to create an if statement (so when no one is logged in nothing is displayed) That's when the page dies for example
<?php if(isset($_SESSION['user_id']) || isset($_SESSION['logged in'])){ ?> // etc
Now I imagine It's an issue with the if statement, which I am calling further down obviously to change the login. Any help where I'm going wrong would be helpful, thanks in advance Error log
[03-Aug-2018 22:43:44 UTC] PHP Parse error: syntax error, unexpected end of
file in C:\Users\b\Desktop\code\clubpage.php on line 39
<body>
<div class ="container">
<header> <a href=""></a>
<h4 class="logo"> Game Finder </h4>
</a>
<nav>
<ul>
<?php if(isset($_SESSION['user_id']) || isset($_SESSION['logged in'])){ ?>
<li> <a href="clubpage.php"> Manage | <?php echo $_SESSION['user_id'] ?> </a></li>
<li> <a href="/index.php">Home</a></li>
<li> <a href="#about"> About</a></li>
<li> <a href="/finder.php"> Finder </a></li>
<?php if(isset($_SESSION['user_id']) || isset($_SESSION['logged in'])){ ?>
<li> <a href="logout.php"> Logout | <?php echo $_SESSION['user_id'] ?> </a></li>
<?php }else{ ?>
<li> <a href="loginpage.php" >login</a></li>
<?php } ?>
</ul>
</nav>
</header>