Choose Between Two Sets of Session
I am trying to create a log in session that has both regular logins and OATH login... the question is this:
How can I set a function in PHP to check for both sets of $_SESSION variables:
- First Check This Session:
if(!isset($_SESSION['logged_in']) || !is开发者_开发技巧set($_SESSION['whatever']) || !isset($_SESSION['whatever']))
- Matches Press On; Does Not Match Check Next One:
if(!isset($_SESSION['logged_in']) || !isset($_SESSION['something']) || !isset($_SESSION['something']))
- Matches Press On; Does No Match Die Session
Ok so it is simplified but the point is if I can create a check of two different Session variables.
yes to last question
the key is to use elseif
if(isset($_SESSION['logged_in_1']) and isset($_SESSION['some_1']){ two vars ok/exists do me stop}
elseif(isset($_SESSION['logged_in_2']) and isset($_SESSION['some_2']){two vars ok/exists do me stop}else{ die }
精彩评论