This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.

Sanitizing User Input

Are you accepting user input and you really need to be sure it comes in in a sanitized format? This can easily be accomplished by using our sanitization libraries:

Basic HTML Special Character Encoding

h($request->request->get('maliciousParameter'));

The POST variable 'maliciousParameter' will be run through htmlspecialchars.

Special Sanitize Methods

Use the sanitizing service to sanitize based on types:

Retrieve the Service

$service = \Core::make('helper/security');

Then you can run all the sanitize methods found in Concrete\Core\Validation\SanitizeService

print $service->sanitizeInt($request->request->get('maliciousInt'));

Or email:

print $service->sanitizeEmail($request->request->get('maliciousInt'));

These methods will only validate integers and emails through.