Jump to content

Menu depending on login


snallemap

Recommended Posts

Alright, so meanwhile i wait for answer on the other thread i started another project, to fix the menu... but it was a bit confusing so now i ask you again!...

 

Heres my current menu.php

 

<?php
    
    include "config.php";

if (!$_SESSION["valid_user"])
        {
echo '<a href="login.php">' . 'Login <br/><br/>' . '</a>';
        }    
        
if ($_SESSION["valid_user"])
        {
echo '<a href="logout.php">' . 'Logout <br/><br/>' . '</a>';

echo '<a href="members.php">' . 'Control Panel <br/><br/>' . '</a>';
        }    


echo '<a href="memberlist.php">' . 'Members <br/><br/>' . '</a>';

echo '<a href="ranking.php">' . 'Rankings <br/><br/>' . '</a>';



?>

 

Now it works perfectly when logged in, but when you logout the session dies, leaving me with this:

 

Notice: Undefined index: valid_user in C:\wamp\www\kawaii\menu.php on line 5

Login

 

Notice: Undefined index: valid_user in C:\wamp\www\kawaii\menu.php on line 10

Members

 

Rankings

 

Now, how can i make a login that depends on if your logged in if this happens when you logout..., i hope someone can find a solution that can work out :(

Link to comment
https://forums.phpfreaks.com/topic/214297-menu-depending-on-login/
Share on other sites

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.