PHP :Session is not working for parent directory
<p>I have my code for setting the session like: </p>

<pre><code>if($found&gt;0){
    session_start();
    $_SESSION['user_name']=$user;

    session_set_cookie_params(24*60*1,'/','.localhost');

    $expire=time()+60*60*24;
    setcookie("cookiename", $user, $expire);

    header("location:http://localhost/UI/user/userprofile.php");
} else{
    $message =  "Username or  password is not correct.";
    header("Location:index.php?message={$message}");
}
</code></pre>

<p>here is my header content  where i put  login and logout</p>

<pre><code>session_start();
if (isset($_COOKIE["cookiename"])){
    $unm = $_SESSION["user_name"];
    echo "User :  " . $_SESSION["user_name"] . "";
    echo " &lt;a href='http://localhost/UI/user/logout.php'&gt;logout&lt;/a&gt;";
    echo " &lt;a class='addmeeting' href='http://localhost/UI/user/createmeeting.php' title='Create New Meeting'&gt;Create Meeting&lt;/a&gt;";
} else{
    echo "&lt;li&gt;&lt;a href='register.php'&gt;Register&lt;/a&gt;&lt;/li&gt;";
    echo " User : Guest!&lt;br /&gt;";
}
</code></pre>

<p>My session is working for subfolder but it is not working for the parent folder.
Here is the directory structure:</p>

<pre><code>UI 
   user
      userprofile.php
      login.php
      logout.php 
   index.php
   headers.php
</code></pre>

<p>Please tell me what i am doing wrong ?</p>
