PHP: PHP login and logou (set session path for  parent folder )
<p>My login code is:    </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>When the user is logged in, I want there to be a Logout link, and when they're not logged in, a Register link.</p>

<p>My files are as follows:</p>

<pre><code> UI
    user(folder)
       userprofile.php
       login.php
       logout.php  
    headers.php 
    index.php 
    footer.php 
</code></pre>

<p>When I am logged in, it always shows Logout, except for on index.php. Outside of the user folder, however, it shows register. </p>

<p>What might be the problem here?<br>
now i update my question </p>
