adds if/else validations in comments and posts controller with flahses and redirects