need help on php if statement

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-05-26T05:19:55Z Indexed on 2010/05/26 5:31 UTC
Read the original article Hit count: 253

Filed under:
<?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");
} 

© Stack Overflow or respective owner

Related posts about php