Jump to content

Starting a Session


stuart7398

Recommended Posts

Hi.

 

I have a members area.

when a member logs in I want their links such as 'Profile' Personal Details' to appear in the left navigation area.

how do I achieve this without losing half the page to unregistered members unless logged in?

 

Any help is appreciated.

 

Thanks,

Stu.

 

 

<?php

require_once('auth.php');

?>

 

<code>

<?php

//Start session

session_start();

//Check whether the session variable

//SESS_MEMBER_ID is present or not

if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID'])=='')) {

header("location: access-denied.php");

exit();

}

?>

</code>

 

Link to comment
https://forums.phpfreaks.com/topic/100503-starting-a-session/
Share on other sites

You can make yourself 2 different navigation pages then just call the correct one depending if logged in or not

 

<?php
//Start session
session_start(); 
require_once('auth.php');
if(!isset($_SESSION['SESS_MEMBER_ID']){
include('guestnav.php');
} else {
include('usernav.php');
}
?>

 

Ray

Link to comment
https://forums.phpfreaks.com/topic/100503-starting-a-session/#findComment-513984
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.