/** Check if the user is authenticated to do the request * @return array */ function authenticate() { if (!isset($_POST['unikey']) && !isset($_POST['u_ID'])) { forbidden_page("Authentication failed, wrong parameters"); } else { $auth = new AuthModel(); $unikey = $_POST['unikey']; $ID = $_POST['u_ID']; if (!$auth->authentication($unikey, $ID)) { forbidden_page("Authentication failed"); } else { return true; } } }