function ManageAuthorization() { if($this->RequiresAuthorization()){ if(!isset($_SESSION['id'])){ header("Location: SessionExpired.php?id=4"); } if(!isset($_SESSION['access'])){ header("Location: SessionExpired.php?id=3"); } if($this->companyid === null) return; if(!isset($_SESSION['companyid'])){ header("Location: SessionExpired.php?id=2"); } if($_SESSION['access'] < 77 && $_SESSION['companyid'] != $this->companyid){ if($this->IsUserAssociatedWithCompany()) { $_SESSION['companyid'] = $this->companyid; } else { header("Location: SessionExpired.php?id=1"); } } } }