stuart7398 Posted April 8, 2008 Share Posted April 8, 2008 hi. i have a members only section where users register and login to view their profile How do i get their links such as 'my profile' 'my messages' to show only when logged in, then to disapear when logged out? would i have to create a new navigation bar and switch between the 2? thanks, stuart. Quote Link to comment Share on other sites More sharing options...
ansarka Posted April 8, 2008 Share Posted April 8, 2008 on display portion of the link check weather logged in or not , by chking the section Quote Link to comment Share on other sites More sharing options...
stuart7398 Posted April 8, 2008 Author Share Posted April 8, 2008 hi. i have a members only section where users register and login to view their profile How do i get their links such as 'my profile' 'my messages' to show only when logged in, then to disapear when logged out? would i have to create a new navigation bar and switch between the 2? thanks, stuart. what would i do to this session to acheive my goal? <?php require_once('auth.php'); ?> <?php $page_title = 'Member Index'; @ require_once ('../inc/head.php'); ?> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <h1>Welcome to Members' area!</h1> <a href="members/member-profile.php">My Profile</a> | <a href="members/logout.php">Logout</a> <p>This is a password protected area only accessible to members. </p> </div></div> <?php @ require_once ('../inc/leftnav.php'); @ require_once ('../inc/rightnav.php'); @ require_once ('../inc/foot.php'); ?> Quote Link to comment Share on other sites More sharing options...
ansarka Posted April 8, 2008 Share Posted April 8, 2008 On login page you have to register some session $_SESSION['uid']=$userid; <?php require_once('auth.php'); if(!$_SESSION['uid']) { header("Location: login.php"); //if not logged in dont allow to view th page exit(); } ?> <?php $page_title = 'Member Index'; @ require_once ('../inc/head.php'); ?> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <h1>Welcome to Members' area!</h1> <?php if($_SESSION['uid']) { ?> <a href="members/member-profile.php">My Profile[/url] | <a href="members/logout.php">Logout[/url] <?php } ?> <p>This is a password protected area only accessible to members. </p> </div></div> <?php @ require_once ('../inc/leftnav.php'); @ require_once ('../inc/rightnav.php'); @ require_once ('../inc/foot.php'); ?> ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.