Can you spot this PHP error? I'm stumped
<p><strong>Here's the scenerio of what is happening in the script:</strong></p>

<ul>
<li>Session is start.</li>
<li><code>$id</code> is set to a number (tournament ID number).</li>
</ul>

<p><strong>Result:</strong></p>

<ul>
<li>User SESSION vars are reset with the ID number and the ID number's respective user data. Essentially logging the user in under a different account.</li>
</ul>

<p><strong>Troubleshooting:</strong></p>

<ul>
<li>Renaming <code>$id</code> to <code>$tid</code> stops the glitch.</li>
<li>Not starting the session (<code>session_start()</code>) stops the glitch.</li>
</ul>

<p><strong>Thought Process:</strong></p>

<ul>
<li>$id must overwrite similar variable which is inside a block which contains:<br />
<code>if(isset( $_SESSION['someVar'] )) {
$id = "some Value";
}</code></li>
</ul>

<p>Since <code>$id</code> is only overwritten when session is started.</p>

<p><strong>The Problem:</strong></p>

<ul>
<li>There is no block of code that uses that syntax.</li>
</ul>

<p>Here's the call stack.</p>

<p>jointourney.php</p>

<pre><code>&lt;?
session_start();
$id = (isset($_POST['id'])) ? $_POST['id'] : false;
include("html.php");
?&gt;
</code></pre>

<p>html.php</p>

<pre><code>&lt;?
if(session_id() == '') session_start();
if(!function_exists('isLogged')) include("includes/islogged.inc.php");
include("includes/autologin.inc.php");
$query = mysql_query("SELECT value FROM config WHERE name='shutdown'");
$query = mysql_fetch_array($query);
$shutdown = end($query);
if(!class_exists('ban')) include("class/ban.class.php");
$ban = new ban();
if(isLogged()){
    $ban-&gt;setUsername($_SESSION['username']);
}
$user_level = (isset($_SESSION['user_level'])) ? $_SESSION['user_level'] : "0";
$ban-&gt;setIP($_SERVER['REMOTE_ADDR']);
if((strlen($shutdown) &gt; 0 || $ban-&gt;isBanned()) &amp;&amp; $user_level == 0 &amp;&amp; strtolower($_SERVER['REQUEST_URI']) != "/login.php"){
    if(strtolower($_SERVER['REQUEST_URI']) != "/error.php"){
        header("Location: ./error.php");
    }
}
?&gt;
</code></pre>

<p>islogged.inc.php<br />
File not needed, no variables set: only returns true/false.</p>

<p>autologin.inc.php</p>

<pre><code>&lt;?
if(!class_exists('login')) include("./class/login.class.php");
$login = new Login();
    if(isset($_COOKIE['username'],$_COOKIE['password']) &amp;&amp; !$login-&gt;isLoggedIn()){
        $login-&gt;setUsername($_COOKIE['username']);
        $login-&gt;setPasswordDirect($_COOKIE['password']);
        if(!$login-&gt;_error){
            $login-&gt;processLogin();
        }
}
?&gt;
</code></pre>

<p>As you see, there is absolutely no place where jointourney.$id can overwrite - since there is no other variable called <code>$id</code> being used.
Note: There are no variables that are being set globally (i.e. global <code>$id</code>)</p>

<p>I do not understand why this is happening, are you guys able to figure this out? Everything you see here is exactly how it looks (minus HTML).</p>
