2
I have a class called "Account" and its methods are the pages that the logged-in user can access, e.g.:
Class account {
function info (){
//bla bla
}
function post () {
// bla bla
}
}
and for each method the user accesses, I have to make a conditional to check if his session is active, ex:
if($userLogged){
//deixar acessar
} else {
//redireciona
}
Is there any way to do a single check for all methods? something like a Construct, for any method that was instantiated the check would already be done and tried to give access or redirect the user.
UPDATING:
Is it safe to make a simple Construct for this? ex:
function __construct() {
if (!$userLogged)
die('blabla');
}