Skip to content

Instantly share code, notes, and snippets.

@chtombleson
Created October 27, 2014 21:18
Show Gist options
  • Save chtombleson/1fec44e1701647a5f8c2 to your computer and use it in GitHub Desktop.
Save chtombleson/1fec44e1701647a5f8c2 to your computer and use it in GitHub Desktop.
Raw PHP sanitisation class
class Sanitise
{
public function get($name, $filter, $options=null)
{
return $this->sanitise(INPUT_GET, $name, $filter, $options);
}
public function post($name, $filter, $options=null)
{
return $this->sanitise(INPUT_POST, $name, $filter, $options);
}
public function cookie($name, $filter, $options=null)
{
return $this->sanitise(INPUT_COOKIE, $name, $filter, $options);
}
public function server($name, $filter, $options=null)
{
return $this->sanitise(INPUT_SERVER, $name, $filter, $options);
}
public function env($name, $filter, $options=null)
{
return $this->sanitise(INPUT_ENV, $name, $filter, $options);
}
private funciton sanitise($type, $name, $filter, $options=null)
{
return filter_input($type, $name, $filter, $options);
}
}
@gitrage
Copy link

gitrage commented Sep 22, 2018

private funciton sanitise - "function" is mis-spelled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment