Auto-login, NTLM header seems to erase $_SESSION on redirect
<p>I'm trying to create an auto login script. The computers are using IE8 on XP. The code successfully retrieves the user's Windows username and places it into a session, but once redirect is complete, the session is wiped clean.</p>

<p>In index.php:</p>

<pre><code>session_start();
if (!isset($_SERVER["AUTH_USER"]) || $_SERVER["AUTH_USER"] == '') {
      header('WWW-Authenticate: NTLM', false);
      exit;
}

# Extract username
$user = explode('\\',$_SERVER["AUTH_USER"]);
$_SESSION['username'] = strtolower($user[1]);
print_r($_SESSION); // Success!
header("Location: index2.php");
</code></pre>

<p>In index2.php:</p>

<pre><code>session_start()
print_r($_SESSION); // Fail. array()
</code></pre>

<p>The key problem seems to be the header part because during testing, I've removed it and put in a dummy username and it successfully passes to the next page. I need the header though, because it is needed to do the NTLM authentication (ie. Put the AUTH_USER details in the $_SERVER array.)</p>

<p>EDIT
I turned off anonymous authentication in IIS, then removed the header part and all worked. However, this creates loads of other problems.</p>
