I have a login system that changes the login boxes to the account info once you are logged in. I would like to have a background and boarder around the account info and not the log in boxes. I tried to add a <div class>
around the if($session->logged_in)
but it didn't seem to work.
Here is my code for the logged in stuff. I just need help adding a div class around it.
<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if ($session->logged_in) {
echo "<div class='welcome'><b>" . $session->username . "</b></div>" . "<div class='account'><a href=\"userinfo.php?user=$session->username\">My Account</a></div> " . "<div class='account'><a href=\"useredit.php\">Edit Account</a></div> ";
if ($session->isAdmin()) {
echo "<div class='account'><a href=\"admin/admin.php\">Admin Center</a></div> ";
}
echo "<div class='account'><a href=\"process.php\">Logout</a>]</div>";
} else {
?>
I'm unsure how are you populating the $session
array as you haven't mentioned whether you're using any CMS or not. I'd first var_dump($sessions)
and confirm whether the values are actually there.
If I understand your question correctly, you want something like this:
if ($session->isAdmin()) {
echo "<div class='accountArea'>";
echo "<div class='account'><a href=\"admin/admin.php\">Admin Center</a></div> ";
echo "</div>";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With