Variable security functions?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
WhatEver
New Member
New Member
Posts: 2
Joined: Mon Jun 28, 2010 8:07 pm

Variable security functions?

Post by WhatEver »

When building new modules for CMS MS does the "core" class provide any functionality to secure input parameters for SQL queries etc or do I need to do this myself?

I've looked through several module codes and I've seen $params['x'] being passed.  Have these already been filtered?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Variable security functions?

Post by calguy1000 »

in the admin, params are not cleaned.

For frontend actions, you can use the SetParameterType method (typically called in the SetParameters method) to specify the type of input params.  and then, yes they are cleaned (entity conversion for strings, etc).

You also should use param-ized queries to the database.  i.e:

Code: Select all

$foo = $db->GetOne('SELECT id FROM table WHERE name = ?',array($name));
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
WhatEver
New Member
New Member
Posts: 2
Joined: Mon Jun 28, 2010 8:07 pm

Re: Variable security functions?

Post by WhatEver »

Thanks for you answer.

What would be the best way to setup a module so that the admin params are cleaned?

(I've only just started to learn the structure of CMS MS!)
Post Reply

Return to “Developers Discussion”