public static function ActionAddComment($postId) { if (UserModel::isUserLoggedIn() and isset($_POST['text'])) { $text = $_POST['text']; PostModel::addComment($postId, $text); } header("Location: " . $_SERVER['HTTP_REFERER']); }