Page 1 of 1

sanitizing field inputs

Posted: Tue Feb 26, 2008 10:15 pm
by madsamurai
I was wondering about the usage of JRequest::clean() vs JRequest::cleanVar()... what is the difference, and when to use which?

I want to sanitize my form input data before I save it to the database, so in my save function would I use something like:

Code: Select all

$data = JRequest::cleanVar( 'post' );
or do I need to include the get(), as in:

Code: Select all

$data = JRequest::cleanVar( JRequest::get( 'post' ) );
or would I use clean() where I've used cleanVar() in these examples? Unfortunately the wiki isn't very helpful for these functions yet. Thanks in advance!

Re: sanitizing field inputs

Posted: Thu Feb 28, 2008 3:22 pm
by madsamurai
OK... maybe I'm asking this the wrong way.

What is the proper way to clean a post array from form inputs? maybe JFilter is what I'm looking for? I keep trying stuff, and just keep getting errors.

Re: sanitizing field inputs

Posted: Thu Feb 28, 2008 10:11 pm
by Rogue4ngel
What version of Joomla are you working with??

Re: sanitizing field inputs

Posted: Thu Feb 28, 2008 10:44 pm
by madsamurai
Rogue4ngel wrote:What version of Joomla are you working with??
working in J1.5.1