0
I have my PHP code created for both log in and log out, I confess that I have read several articles on google how to turn a log in button into log out but I confess that the read did not help at all, I am here to ask if someone can enlighten me how to do. My index page (VIEW PHOTO) has a button called Member area that I would like to become a button called log out when the user logs in. Updated code:
[![<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<nav class="navigation">
<ul class="mainmenu
">
<li><a href="index.html"><i class="material-icons">home</i></a></li>
<li><a href="">Books Categories</a>
<ul class="submenu">
<li><a href="bookcomputing.php">Computing</a></li>
<li><a href="bookromance.php">Romance</a></li>
<li><a href="bookfiction.php">Fiction</a></li>
<li><a href="booknonfiction.php">Non-Fiction</a></li>
</ul>
</li>
<li><a href="contact.html">Contact us</a></li>
</ul>
</nav>
<div id="memberarea">
<?php
if (!isset($_SESSION\['email'\])) {
echo "<a href='memberarea.html'>Member area</a>";
} else {
echo "<a href='logout.php'>Log out</a>";
}
?>
<a href="adminarea.php"><span class="glyphicon glyphicon-lock"></span> Admin area</a>
</div>
<form action="search.php" method="GET" id="search">
<input type="text" name="query" placeholder="author's name, title">
<input type="submit" value="Search">
</form>
<p> Welcome to Galaxy Book Store website, this website was created for people who really enjoy reading all sort of books.</p>
<p>Here you can find a huge amount of books.</p>
</body>
</html>
<footer>
<p> ® Galaxy Books Store</p>
</footer>][2]][2]
Anderson I solution that Voce presents, Oce suggests that I put this information in login.php or in memberarea.html (I just edited my comment to put the password memberarea.html.)
– Diana Madeira
The solution is not mine, I just improved the formatting. But this code should go on the page where you display the link Member Area that you wish me to change to Logout.
– Woss
@Dianamadeira in either. You will put this code in your menu.
– Victor Eyer
what menu VME? sorry but I’m not getting it
– Diana Madeira
Instead of this "Member Area" button put the code I said
– Victor Eyer
<a href="memberarea.html"><span class="glyphicon glyphicon-user"></span> Member area </a> <br> this is the button that I have at the moment, already replaces and did not work very well
– Diana Madeira
Report what has happened
– Victor Eyer
updated the code where I put the code Voce suggested and added a photo where it shows the result.
– Diana Madeira
You changed all the code I sent. I ask you to put it exactly as I told you. At the beginning of the page, add a <?php session_start(); ?>
– Victor Eyer