Your opinion: "best" place to sanitize user input. - Joomla! Forum - community, help and support


hello guys,
i know opinion "best" place sanitize user input.
my primary work develop joomla! components process user input (e.g. search strings, form fields... , on).
to have idea, had @ joomla's search component. checking input performed in component's controller class:

code: select all

...
function search()
   {
      // slashes cause errors, <> stripped anyway later on. # causes problems.
      $badchars = array('#', '>', '<', '\\');
      $searchword = trim(str_replace($badchars, '', jrequest::getstring('searchword', null, 'post')));
      // if searchword enclosed in double quotes, strip quotes , exact match
      if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
         $post['searchword'] = substr($searchword, 1, -1);
         jrequest::setvar('searchphrase', 'exact');
....


however, in source codes perform user input validation in model classes before build sql queries.
i glad know opinion or experience on th "best" place sanitize user input.
thanks in advance.






Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

PProHeadless.exe has stopped working error when opening projects in Adobe Media Encoder CS6

Preconditions Failed. - Joomla! Forum - community, help and support