Private message system page view thingy

Post here is you are having problems with any of the tutorials.
Post Reply
MrPancake
Posts: 2
Joined: Sat Jan 05, 2013 11:27 am

Private message system page view thingy

Post 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,
MrPancake
Posts: 2
Joined: Sat Jan 05, 2013 11:27 am

Re: Private message system page view thingy

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Private message system page view thingy

Post 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.
Image
Post Reply