title: Session-Handling doesn't set properly on PHP
body: <p>I'm working on php-Website for my School-Project which I have to get finished soon. Now I'm stuck with my Session-Handling. User signup &amp; login works just fine. But this variable isset($_SESSION[&quot;useruid&quot;]) is always false and doesn't let me access the homepage, even the alert in the header says, that I am successfully logged in.</p>
  <p>Here are the two parts, which I think the error might be:</p>
  <p>functions.inc.php</p>
  <pre><code>function loginUser($connection, $username, $pwd){
  
      $uidExists = uidExists($connection, $username);
  
      if ($uidExists === false) {
          header(&quot;location: ../login.php?error=wronglogin&quot;);
          exit();
      }
  
      $pwdHashed = $uidExists[&quot;usersPwd&quot;];
      $checkPwd = password_verify($pwd, $pwdHashed);
  
      if ($checkPwd === false) {
          header(&quot;location: ../login.php?error=wronglogin&quot;);
          exit();
      }
      else if ($checkPwd === true) {
          session_start();
          $_SESSION[&quot;userid&quot;] = $uidExists[&quot;usersId&quot;];
          $_SESSION[&quot;useruid&quot;] = $uidExists[&quot;usersUid&quot;];
          header(&quot;location: ../index.php?error=loginsuccessful&quot;);
          exit();
      }
  }
  </code></pre>
  <p>home.php</p>
  <pre><code>&lt;?php
    include_once 'header.php';
  
    if (is_null($_SESSION[&quot;useruid&quot;])) {
        header(&quot;location: index.php&quot;);
        exit();
    }
  ?&gt;
  
  &lt;button&gt;
      &lt;?php
          if (isset($_SESSION[&quot;useruid&quot;])) {
              echo &quot;&lt;a href='includes/logout.inc.php' class='nav-link'&gt;Abmelden&lt;/a&gt;&quot;;
          }
          else{
              echo &quot;&lt;a href='login.php' class='nav-link'&gt;Anmelden&lt;/a&gt;&quot;;
          }
      ?&gt;
  &lt;/button&gt;
  
  &lt;?php
    include_once 'end-section.php';
  ?&gt;
  </code></pre>
  <p>For the whole small project-code visit my Gitlab: <a href="https://gitlab.iet-gibb.ch/agn122703/secapp" rel="nofollow noreferrer">https://gitlab.iet-gibb.ch/agn122703/secapp</a></p>