09-17-2017, 07:03 PM
Try reversing the logic by killing the page or redirecting somewhere if the user is not logged in or does not have permission first. Here's a an example with die();
Code:
<?php
Code:
if (!$user->isLoggedIn() || !hasPerm([2],$user->data()->id)){
Code:
die(); //or something
Code:
}else{
Code:
//the rest of your script
Code:
?>