function declineInvitationExe() { if (!is_numeric($_SESSION['userId'])) { print "Wrong way"; exit; } if (!isset($_REQUEST['invitationId'])) { print "Wrong Invitation"; exit; } $d = new Delegate(); $loggedUser = $d->userGetById($_SESSION['userId']); $invitation = $d->invitationGetById($_REQUEST['invitationId']); if ($invitation->email == $loggedUser->email) { //a match made in stars...how lovely :) $d->invitationDelete($invitation->id); addMessage("Invitation declined."); } redirect('../myDiagrams.php'); }