kwandoa Posted April 22, 2013 Share Posted April 22, 2013 I understand why one would use the ($_SESSION['agent']), what I would like to ask though is why , in the conditional <? if (!isset($_SESSION['agent']) OR ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT']) )) { ?> you would use OR and not AND. I would think that you would check for both? Link to comment Share on other sites More sharing options...
Larry Posted April 22, 2013 Share Posted April 22, 2013 That code is looking for a point of failure, so either condition being false is sufficient. If the conditional was confirming success, it would be if (isset($_SESSION['agent']) AND ($_SESSION['agent'] === md5($_SERVER['HTTP_USER_AGENT']) )) { Notice three changes required: Removal of ! in the first condition Use of AND instead of OR Change of != to === in the second condition 1 Link to comment Share on other sites More sharing options...
Recommended Posts