Have built a login system, I can assign permissions to a user which lets them access a page or not, all works fine. Currently if the user is logged in it and has permission is shows the content and if not logged in it redirects to login page.
I am trying to add a redirect in so that if you are logged in but do no have permission then it takes you to the page which has information on the product.
I have it currently set up as :
<?php
if (!securePage($_SERVER['PHP_SELF'])){die();}
$parts = parse_url($_SERVER["REQUEST_URI"]);
$page_name = basename($parts['path']);
//Links for logged in user
if(isUserLoggedIn()) {
//Links for permission level 3 (BOF)
if ($loggedInUser->checkPermission(array(3))){
*do something*
(more code)
<div id='default'>
<?php } else { ?>
*login*
I know I could do going through and say "If permission is not this then do this" but I have over 20 permissions currently and climbing. I was trying something like:
if ($loggedInUser <> 3){
header( 'Location: http://www.yoursite.com/new_page.html' ) ;
}
However it parses but displays no result, I'm guessing its something to do with the variable being empty?
Any ideas on the best workout please?