Okay as some of you might know, I'm currently developing the tablemanager.module and have NO previous php or mysql programming experience ;o) And I think I'm doing alright at the moment!
The module completely works (although maybe the code is ugly!) and in its current attic state (version 1.1.2.10), is actually finished... But... At the moment the module passes all the table data to a validation function... which is completely empty and does nothing but pass the remark // to do...
then return right back again. Not really a problem particularly as anonymous users do not have access to it unless you give them permission to, but in the future I'd planned to have a function which allows an admin to set tables to be 'accessible to all roles' so that maybe people could add their contact details to it, or their CD collections, or any type of collections... Anyways, the point of this is that if anonymous users *will* be allowed access (even if it isn't yet) then the data needs to be stripped of anything malicious because the tables are stored in the database. I'm completely worried that my module is going to be a security hole... So I need to get this right for my own peace of mind!!!
Is it enough to just pass the data through $check_ouput()? I'm guessing it is, as anonymous users can post into the forums using the default filtered html option (which check_output uses by default) - and this will strip any nastiness out??? Right??? Or... Should I completely restrict whats entered by doing something like this:
<?php
$test = "blah blah test"; // string to be tested
$name="name"; // form_textfield name
if (eregi('[^a-z 0-9_-]', $test)) {
form_set_error($name, t('The specified string contains one or more illegal characters.