title: isset and if function in php with or operator
body: <p>I have some PHP code to check user login status which check if session variables are set or cookies are set. If either of condition is true then it grand permission otherwise redirect to login page. Code looks like this :</p>
  
  <pre><code>if(isset($_SESSION["userid"]) || isset($_COOKIE["userid"]) &amp;&amp; isset($_SESSION["username"]) || isset($_COOKIE["username"])  &amp;&amp; isset($_SESSION["password"]) || isset($_COOKIE["password"])){
  } else {
  header("location : register.php");
  }
  </code></pre>
  
  <p>The problem is that if session get destroyed (by closing browser or any other reason) it redirect the user to login page. But what it has to do is read cookies data and grant user access as cookies are still present (I've checked that cookies are still present by echo cookie data).</p>