关于我的页面验证或验证

this is my code: is it possible to make

if(isset($_GET['home'])){
if($_SESSION['valid_user']==null){
    $_SESSION['pages']=0;//this is when user is not login or visitor
}else{
    if($_SESSION['valid_admin']==1){
        $_SESSION['pages']=1;//this is when user is login as admin
    }else{
        $_SESSION['pages']=2;//this is where user is login
    }
}
}

when i make my code like this.

 if(isset($_GET['home'])){
if($_SESSION['valid_user']==null){
    $_SESSION['pages']=0;//this is when user is not login or visitor
}else{
    if($_SESSION['valid_admin']==null){
        $_SESSION['pages']=0;//this is when user is login as admin
    }else{
        $_SESSION['pages']=2;//this is where user is login
    }
}
}

where should i put the code for if the valid_admin or admin_user is login i created 3 different pages for my home page.. 1=for user 1=for admin and 1=for visitor sorry for my bad english im am just and newbie in php...

I would go with something like:

if(isset($_GET['home'])){
  if(isset($_SESSION['valid_user'])) {
    $_SESSION['pages']=0;//this is when user is not login
  } else {
    if(isset($_SESSION['valid_admin'])) {
      $_SESSION['pages']=1;//this is when user is login as admin
    } else {
      $_SESSION['pages']=2;//this is where user is login or Visitor
    }
  }
}

and in that case you only set the according $_SESSION member.