Jump to content

header()


brown2005

Recommended Posts

hi, if I want to stop people from viewing certain pages how would I do it? I have used

 

if(isset($_SESSION['MembersID']))

{

 

 

}

else

{

 

header('location: '.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=account&view=login');

 

}

 

but i keep getting headers already sent message, so how would I get around this? or can't I?

Link to comment
https://forums.phpfreaks.com/topic/41140-header/
Share on other sites

<?php
if(!isset($_SESSION['MembersID']))
{
header('location: '.$config_website_url.'/'.$config_website_url_topic.'/index.php?page=account&view=login');
} else {
?>

PUT ALL YOUR PAGE INORMATION HERE!

<?php
}
?>

 

Just changing the first statement to a negative works fine. if(!isset($_SESSION['MembersID']))

 

Snooble

Link to comment
https://forums.phpfreaks.com/topic/41140-header/#findComment-199405
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.