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

  • Home
  • SEARCH
  • 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 807681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:26:25+00:00 2026-05-15T00:26:25+00:00

<?php if (!isset($_SESSION[‘loginAdmin’]) || ($_SESSION[‘loginAdmin’] == ”)) { header (Location: loginam.php); } else {

  • 0
<?php
if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) {
    header ("Location: loginam.php");
} else {
    include('head2.php');
}


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

?>  

I’m really stuck at this problem. What I want to do is to be able to redirect the user to another page base on the information entered.

My problem is:

if this statement is true:

else {
        include('head3.php'); 
    }

This one would also be true:

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

Leading me to the login page whether I’m admin or just ordinary user. Is it possible two separate the two if statements so that if this is true:

else {
    include('head3.php'); 
}

Then this statement shouldn’t get in the way and redirect me back to the login page:

if (!isset($_SESSION['loginAdmin']) || ($_SESSION['loginAdmin'] == '')) {
    header ("Location: loginam.php");
} 
  • 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-15T00:26:25+00:00Added an answer on May 15, 2026 at 12:26 am

    What you can do is.. have a variable called usertype…

    $_SESSION['usertype'] = 1 //for admin
    $_SESSION['usertype'] = 2 //for regular user
    

    Now Depending on the type of user, you can redirect the user.

    if($_SESSION['usertype'] == 1)
    header ("Location: admin.php");
    else if($_SESSION['usertype'] == 2)
    header ("Location: user.php");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 506k
  • Answers 506k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've figured this out, so I'll share my input. When… May 16, 2026 at 3:47 pm
  • Editorial Team
    Editorial Team added an answer Fabric is definitely a nice way to accomplish this. There… May 16, 2026 at 3:47 pm
  • Editorial Team
    Editorial Team added an answer YOu need to set the NSSlider to continuous. Ther should… May 16, 2026 at 3:47 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

here is the code <?php session_start(); if(!isset($_SESSION['user_name'])) { header('Location: login.php'); } $conn = mysql_connect(localhost,
<?php //login_success.php session_start(); if(isset($_SESSION['username'] = $myusername)){ header(location:main_login.php); } ?> <html> <body> Login Successful </body>
I have the following pages: page1.php <?php if (isset($_GET['link'])) { session_start(); $_session['myvariable'] = 'Hello
my code for the php page displaying the divs <?php session_start(); require_once(classlib/mainspace.php); if (isset($_SESSION['username'])==FALSE)
I've done tons of redirects using PHP's header function. This one has stumped me.
Okay. I have this code on my site: <?php session_start(); include database.php; include bruger.php;
I have a basic PHP question, take the code below for example, let's say
The code below gets the username/password and runs it thru the backend.php script. <?php
I am working on a simple login and logout module for my website without
I have read many php tutorials for logout scripts, i am wondering what could

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.