public function validate() { $r = new Researcher(); if (is_array($_SESSION['user'])) { $this->data = $_SESSION['user']; } else { if (empty($_POST['email']) or empty($_POST['password'])) { return; } $this->data = $r->validate($_POST['email'], $_POST['password']); $_SESSION['user'] = $this->data; } if (!$r->validstudy()) { die("you do not have access to this study!"); } }