function __construct() { if (SessionManager::isAuthorized()) { header('Location:/main'); die; } }
/** * Created by PhpStorm. * User: Dushyant * Date: 2015-07-25 * Time: 11:47 PM */ require_once '../../Local/Classes/config.inc'; require_once '../../Local/Classes/class.SessionManager.inc'; session_start(); //Don't allow user to access this page with out logging in and if user role != "Admin" //Check if user is login or redirect to log in page. if (isset($_SESSION['loginUserId'])) { $userSession = new SessionManager(); //if user is log in check user is authorized to use admin pages. //if not authorized redirect to login page. if (!$userSession->isAuthorized('Admin', $_SESSION['loginUserRole'])) { header('Location: ../login.php'); } } else { header('Location: ../login.php'); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="">
/** * Created by PhpStorm. * User: Dushyant * Date: 2015-07-25 * Time: 11:47 PM */ require_once '../../Local/Classes/config.inc'; require_once '../../Local/Classes/class.SessionManager.inc'; session_start(); //Don't allow user to access this page with out logging in and if user role != "Doctor" //Check if user is login or redirect to log in page. if (isset($_SESSION['loginUserId'])) { $userSession = new SessionManager(); //if user is log in check user is authorized to use admin pages. //if not authorized redirect to login page. if (!$userSession->isAuthorized('Doctor', $_SESSION['loginUserRole'])) { header('Location: ../login.php'); } } else { header('Location: ../login.php'); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="">