开发者

Choose Between Two Sets of Session

开发者 https://www.devze.com 2023-03-25 20:34 出处:网络
I am trying to create a log in session that has both regular logins and OATH login... the question is this:

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 }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号