Jump to content

Strange things with sessions not changing links


AdRock

Recommended Posts

I have a really strange problem with sessions even tho the sessions are working

 

When i login i get redirected to a success page (test page) which shows that the sessions are registering but when the success page loads, it appears that the page is ignoring the sessions when displaying links

 

<div class="news">
    <div class="heading">
        <h3 class="head">Membership</h3>
    </div>
    <ul class="menu2">
    <?php
        if(isset($_SESSION['username'])) {
            echo "<li><a href=\"edit_profile.php\">Edit Profile</a></li>";
            echo "<li><a href=\"logout.php\">Logout</a></li>";
        }
        else {
    echo "<li><a href=\"register.php\">Register</a></li>";
    echo "<li><a href=\"login.php\">Login</a></li>";
        }

        if ($_SESSION['user_level'] == 3) {
            echo "<li><a href=\"/admin/\">Admin Menu</a></li>";
        }
    ?>
    </ul>
</div>

 

I want the links to change depending if the user has logged in or not.

 

What is weird is that it will change later on but not straight away after the page redirects

I have a function called at the top of the page and in it is session_start

 

It's really weird.  When the page first redirects using header location, it doesn't change until i manually click a link, and when the page changes, the links change then

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.