Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 802899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:40:22+00:00 2026-05-14T23:40:22+00:00

Please give me an idea on how to display elements in a page depending

  • 0

Please give me an idea on how to display elements in a page depending on who is logged in. For example, a user or an administrator.
I’m thinking of something like this but I get a parse error, what do I lack in this code?:

EDIT:

 <?php

session_start();

if (!(isset($_SESSION['loginAdmin']) && $_SESSION['loginAdmin'] != '')) {
header ("Location: loginam.php");
}

else if (!(isset($_SESSION['loginAdmin']) && $_SESSION['loginAdmin'] =='')) { 
                                                 include('head2.php');  
                                                   }


else if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
header ("Location: login.php");
}

else if  (!(isset($_SESSION['login']) && $_SESSION['login'] =='')) { 
                                            include('head3.php');
                                                   }    

?>    

Please help, there’s no error but its not functioning properly. Whenever I try to access the page where I have this code. And login as a user. It redirects to loginam.php(the page where the admin will login). But there’s no problem when I log in as admin. It works properly. What do I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:40:23+00:00Added an answer on May 14, 2026 at 11:40 pm

    Use

    if (condition)
    { 
    
    }
    else if (condition) {
    
    }
    

    Also Just to make things simpler .. try something like ..

    function is_admin() {
    
    if(isset($_SESSION['loginAdmin']) && $_SESSION['loginAdmin'])
      return true;
    } else {
      return false;
    }
    }
    

    and then check

    if(is_admin()) {
    ///admin block
    } else {
    //admin login
    }
    
    
    
    if(is_user()) {
    ///user block
    } else {
    //user login
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please give me an idea of how the WIRED Magazine on iPad
It does not matter what programming language. Can anyone please give me an idea
Please give me a real time example for singleton pattern . Different threads accessing
Please give me an example for MVC pattern used in Java SWING package ?
Please give me some examples of jump table usage. I have seen this example
Can someone please give some fair idea about how to use JSON?
I am always bad in java. Could please give me any idea about the
I am new to grail, please give me idea how to apply constraint on
Please give some idea. how to solve the error? echo <td class='bold'>Race Category<span class='star'>*</span></td>;
I want to record incoming call,any body knows please give some idea about that,other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.