/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Show if Admin Logged In

Okay I can’t figure out what I’m doing wrong here..

I have 2 access levels 0 & 1

[LIST]

  • [*]

    0 = administrator


  • [*]

    1 = regular user

  • [/LIST]

    I have it so, when a user is not logged in it shows the login form, and when they are logged in it shows them options.

    [code=php] if ($_SESSION[‘MM_UserGroup’] > “”) {
    print $loggedin;
    }
    else {
    print $loginform;
    }[/code]

    So then.. in a seperate location.. i wanted a link to the administration panel to show when an administrator was logged on…

    So I tried this:

    [code=php]
    if ($_SESSION[‘MM_UserGroup’] = “0”) {
    echo “[admin panel]”;
    }
    else {
    echo “”;
    }
    [/code]

    But.. it just echoes out the text [admin panel] regardless if a user is even logged in or not?

    Thanks =]

    to post a comment
    PHP

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @MrCoderFeb 29.2008 — if ($_SESSION['MM_UserGroup'] [B][COLOR="Red"]!=[/COLOR][/B] "")

    if ($_SESSION['MM_UserGroup'] [B][COLOR="Red"]==[/COLOR][/B] "0")

    [code=php]
    // Use "=" to assign a value
    $a = "foo";
    $b = "bar";
    $a = $b; // $a is now "bar"

    // Use "==" to compare a value
    $a = "foo";
    $b = "bar";
    if($a == "foo") // True
    [/code]
    Copy linkTweet thisAlerts:
    @cinematic_jesiauthorFeb 29.2008 — Dang it! Why is it always the simple stuff??? GRR! Stupid == lol.

    Anyhoo -- Thanks Much!! =]
    ×

    Success!

    Help @cinematic_jesi spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...