title: PHP session variables lost in Firefox 63.0, Safari 12.0 on MacOS Mojave and Safari on iOS 12.0.1
body: <p>The latest Firefox, version 63.0, on both Mac and Windows, has somehow broken the login I have built for the admininstrative backend of my ecommerce website. This was previously working fine. I use PHP.</p>
  
  <p>On successful login with valid credentials a <code>$_SESSION['admin_logged_in']</code> variable is set to <code>TRUE</code> and I am correctly logged in and redirected to a starting page. However when I then attempt to navigate to any other page within the admin site I am immediately logged out as if the session variable has suddenly been lost.</p>
  
  <p>On every single page at the very beginning, including the starting page, I have an include with a short login check script which is as follows:</p>
  
  <pre><code>&lt;?php
  //start session
  session_start() ;
  //check user is logged in
  if (($_SESSION['admin_logged_in'] !== TRUE) || (!isset($_SESSION['admin_logged_in']))) {
      header("location: /index.php") ;
      $_SESSION['admin_reason'] = "illegal" ;
      exit;
      }
  ?&gt;
  </code></pre>
  
  <p>I may have thought this a bug with Firefox however recently I am also logged out, usually though after navigating through a couple of pages, by the latest version of Safari on iOS 12 and MacOS Mojave.</p>
  
  <p>Currently working and no problems on Opera or Chrome (tested on Mac).</p>
  
  <p>I have tried clearing the cache in Firefox and adjusting the privacy settings but no luck. I have spoken with my web hosts and they are not aware of any server side issues or changes.</p>
  
  <p>But if there was a problem with the PHP code and session variables, since this is handled server side, presumably it would not work on any browser and also not worked previously? </p>
  
  <p>Grateful for any suggestions.</p>
  
  <hr>
  
  <p>I managed to solve this issue, please see my answer below.</p>