Re: clean data
| From: | Shawn McKenzie | Date: | Tue, 28 Oct 2008 23:42:41 +0000 |
| Subject: | Re: clean data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282546@lists.php.net to get a copy of this message | ||
blackwater dev wrote:
> I have a project now where we would like to properly remove unwanted data
> before it goes into the db such as ` and of course slashes. The problem is
> I have tons of pages. Is there an easy way to add in a clean up routine on
> the db side to clean it going in and coming out without having to touch each
> page that inserts it into the db and each page that presents it?
>
> I'm using a MySQL db.
>
>
> Thanks!
>
Just do a global search/replace on all of your files replacing
mysql_query with to mysafe_query. Then in one of your always included
files create a mysafe_query() function to do the sanitizing that you
want. There are lots of free tools to do this. I use kfilereplace on
kubuntu. I wrote a simple one for windows in C# which you can have.
If needed, you could also extend this to mysql_fetch_row() etc...
-Shawn
--
Thanks!
-Shawn
http://www.spidean.com