Jump to content

[SOLVED] Members Only


stuart7398

Recommended Posts

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.

Link to comment
Share on other sites

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');

?>

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

 

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');
?>

  ;) ;) ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.