View Single Post
Old 05-11-2008   #2 (permalink)
whelpton
Registered User
 
Join Date: May 2008
Location: Sheffield, United Kingdom
Posts: 2

This is kindof like the code I created for that.

PHP Code:
<?php
if($_SESSION['s_logged_n'] == 'true'){
include 
'menulog.php';
?>
<?php
} else {
include 
'menuunlog.php';
}
?>
That means that anyone who is logged into the page will see menulog.php and anyone who isnt will see menuunlog.php

This is the easiest way ive found to create dynamic menu systems like that and it also means that you can quiclky adjust your menus without trying to find the right section of code.

Alternativly if you feel like doing it your way and not using includes paste this code into your site =)

PHP Code:
<?php
if($_SESSION['s_logged_n'] == 'true'){
echo 
"
<p>Welcome '.$_SESSION['s_username'].'! <a href='http://example.com/member.php'>Control Panel</a> | <a  href='http://example.com/logout.php'>Logout</a></p>
"
;
?>
<?php
} else {
echo 
"
<p>Welcome Guest! Please Login or Register</p>
"
;
}
?>

Last edited by whelpton; 05-11-2008 at 06:26 PM.. Reason: Better answer
whelpton is offline   Reply With Quote