Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login Background Change

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> &nbsp;&nbsp;" . "<div class='account'><a href=\"useredit.php\">Edit Account</a></div> &nbsp;&nbsp;";
    if ($session->isAdmin()) {
        echo "<div class='account'><a href=\"admin/admin.php\">Admin Center</a></div> &nbsp;&nbsp;";
    }
    echo "<div class='account'><a href=\"process.php\">Logout</a>]</div>";
} else {
?>
like image 275
s28400 Avatar asked Oct 21 '22 04:10

s28400


1 Answers

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> &nbsp;&nbsp;";
    echo "</div>";
}
like image 71
Amal Murali Avatar answered Oct 23 '22 19:10

Amal Murali