Security: sanitize potentially unsafe data before it is used in header redirects

There are a few spots in the current codebase where unsanitized user and system data is directly used in a header() redirect. This pull request uses the new SecurityHelper to sanitize input where appropriate.

More information: https://www.owasp.org/index.php/Open_redirect