Php session scope in subfolder with ajax
<p>I have a user login session running on the / level, which works fine, then I have a javascript that is making calls to a file /php/ajax.php for working with a database backend. Thing is I would like to have session data from the initial login on / level transfer to the ajax.php, which it does not. Got any reasonable ideas on this topic?</p>

<p>page checking for login:</p>

<pre><code>&lt;?php
session_start();
echo session_id();
if(!isset($_SESSION['loggedin']))
{
    die("To access this page, you need to &lt;a href='login.php'&gt;LOGIN&lt;/a&gt;");
} 

define('WP_USE_THEMES', false); //loads wordpress
require('/home/content/70/9551370/html/alpha/wordpress/wp-blog-header.php');
query_posts('showposts=1');
?&gt;
&lt;head&gt;
    &lt;link href="css/style.css" rel="stylesheet" type="text/css"&gt;
    &lt;link rel="stylesheet" type="text/css" href="css/page.css" /--&gt;
    &lt;link rel="stylesheet" type="text/css" href="css/chat.css" /&gt;
&lt;head&gt;
&lt;body&gt;
&lt;div class="background_container" style=""&gt;
&lt;div style="text-align:center;"&gt;
&lt;table style="text-align:center;"&gt;&lt;!--three column division--&gt;
&lt;tr&gt;
&lt;td id="chat"&gt;
&lt;div id="chatContainer"&gt;

    &lt;div id="chatTopBar" class="rounded"&gt;&lt;/div&gt;
    &lt;div id="chatLineHolder"&gt;&lt;/div&gt;

     &lt;div id="chatBottomBar" class="rounded"&gt;
        &lt;div class="tip"&gt;&lt;/div&gt;

        &lt;form id="loginForm" method="post" action=""&gt;
            &lt;input id="name" name="name" class="rounded" maxlength="16" /&gt;
            &lt;input id="email" name="email" class="rounded" /&gt;
            &lt;input type="submit" class="blueButton" value="Login" /&gt;
        &lt;/form&gt;

        &lt;form id="submitForm" method="post" action=""&gt;
            &lt;input id="chatText" name="chatText" class="rounded" maxlength="255" /&gt;
            &lt;input type="submit" class="blueButton" value="Submit" /&gt;
        &lt;/form&gt;

    &lt;/div&gt;

&lt;/div&gt;
    &lt;!--table&gt;
        &lt;tr&gt;
            &lt;td class="window_top"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td class="window_bottom"&gt;&lt;div&gt;chat form goes here&lt;/div&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table--&gt;
&lt;/td&gt;
&lt;td class="lesson"&gt;&lt;!--Wordpress posts--&gt;
    &lt;?php while (have_posts()): the_post(); ?&gt;
      &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
      &lt;?php the_excerpt(); ?&gt;
      &lt;a href="&lt;?php the_permalink(); ?&gt;" class="text1"&gt;Read more...&lt;/a&gt;
     &lt;?php endwhile; ?&gt;
    &lt;/td&gt;
&lt;td&gt;&lt;!--End Wordpress--&gt;
&lt;h2&gt;Tracking&lt;/h2&gt;
&lt;p&gt;&lt;?php Print_r ($_SESSION); ?&gt;&lt;/p&gt;

&lt;form action="" method=""&gt;
&lt;ul id="grade_list" style="list-style:none;"&gt;

    &lt;li&gt;1. &lt;Input type = 'radio' Name ='lesson1'  checked="checked" value= 'yes'&gt;Yes&lt;/input&gt;
        &lt;Input type = 'radio' Name ='lesson1'  value= 'no'&gt;No&lt;/input&gt;
    &lt;/li&gt;
    &lt;li&gt;2. &lt;Input type = 'radio' Name ='lesson2'  checked="checked" value= 'yes'&gt;Yes&lt;/input&gt;
        &lt;Input type = 'radio' Name ='lesson2'  value= 'no'&gt;No&lt;/input&gt;
    &lt;/li&gt;
    &lt;li&gt;3. &lt;Input type = 'radio' Name ='lesson3'  checked="checked" value= 'yes'&gt;Yes&lt;/input&gt;
        &lt;Input type = 'radio' Name ='lesson3'  value= 'no'&gt;No&lt;/input&gt;
    &lt;/li&gt;
&lt;/ul&gt;
    &lt;Input type = "Submit" Name = "Submit1" Value = "Submit"&gt;
&lt;/form&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="js/jScrollPane/jquery.mousewheel.js"&gt;&lt;/script&gt;
&lt;script src="js/jScrollPane/jScrollPane.min.js"&gt;&lt;/script&gt;
&lt;script src="js/script.js"&gt;&lt;/script&gt;
&lt;/body&gt;
</code></pre>

<p>Ajax.php:</p>

<pre><code>&lt;?php

$dbOptions = array(

    'db_host' =&gt; 'ip',
    'db_user' =&gt; 'user',
    'db_pass' =&gt; 'password',
    'db_name' =&gt; 'db_name'
);

/* Database Config End */

error_reporting(E_ALL ^ E_NOTICE);

require "classes/DB.class.php";
require "classes/Chat.class.php";
require "classes/ChatBase.class.php";
require "classes/ChatLine.class.php";
require "classes/ChatUser.class.php";

session_start();

...
?&gt;
</code></pre>
