Page 1 of 1

Private message system page view thingy

Posted: Sat Jan 05, 2013 11:36 am
by MrPancake
Hey, MrPancake here. I'm having a question about view pages while you are not logged in on the private message system.

In the tutorial is explained how to redirect to the login page if a session has not been set yet.
But what if i would make a profile page with the system and i would send some people a link to my profile so they could look at it?
then they need to login. so my question is how to make it like that, so if they go to the inbox page they wil be redirected to the login page, and if they go to the profile page they wont be redirected to the login page.

i hope thay you guys understand my question (english is not my best subject)

MrPancake,

Re: Private message system page view thingy

Posted: Sat Jan 05, 2013 6:17 pm
by MrPancake
I got it,

just include:
if(empty($_SESSION['user_id']) && $_GET['page'] !== 'login'){
	header("location: index.php?page=login");
	die();
}
at the pages where you need to be logged in.

Re: Private message system page view thingy

Posted: Thu Jan 10, 2013 7:26 pm
by jacek
Sorry for the delay :( You should also be able to do that in the init.inc.php file if you are using it :) Either way is good.