added redirect for empty post and XSS attack prevention