Show if Statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mbustamante
Forum Newbie
Posts: 1
Joined: Thu Sep 23, 2010 8:23 pm

Show if Statement

Post by mbustamante »

I'm designing this website that has a public and private site. After the user logs in I want the log in area to be hidden and the logout button and "Return to homeowners site" button to show. This is the code I have right now, but it just keeps the top part up the whole time, even when I'm logged out. What am I doing wrong?

Code: Select all

<?php if (!isset($_SESSION['username'])) { ?>
Return to <a href="directory.php" class="style5">homeowners site</a>. <br />
<a href="<?php echo $logoutAction ?>" class="style5">Log out</a><br />

<?php } else { ?>
<br />
</MMECORATION></MM_HIDDENREGION> 
<form id="login" name="login" method="POST" action="<?php echo $loginFormAction; ?>">
<span class="style4">username
<input type="text" name="username" id="username" />
<br />
password </span>
<input type="password" name="password" id="password" />
<br />
<input type="submit" name="Submit" id="Submit" value="Submit" />
</form>

<?php } ?>
[CODE]
User avatar
mecha_godzilla
Forum Contributor
Posts: 375
Joined: Wed Apr 14, 2010 4:45 pm
Location: UK

Re: Show if Statement

Post by mecha_godzilla »

Have you unset the session values and/or destroyed the session after you've logged out, and then redirected to another page afterwards?

HTH,

Mecha Godzilla
Post Reply