...

View Full Version : Flat file database input cleansing...



johnnnn
02-28-2010, 04:20 PM
I'm working on a small project. It uses flat files, not MySQL. I know that anything being recorded to the database should be checked and cleaned.

I'm just wondering, should I use the following code in my function:


if(get_magic_quotes_gpc()) $str = stripslashes($str);

Making my cleansing function:


function cleaninput($str) {
$str = trim(strip_tags($str));
$str = htmlentities($str);
if(get_magic_quotes_gpc()) $str = stripslashes($str);
return $str;
}

Any suggestions?

kbluhm
02-28-2010, 06:25 PM
How are you writing to your files? Is it a line-by-line delimited text file, a PHP file containing arrays, etc?

johnnnn
03-01-2010, 04:50 PM
How are you writing to your files? Is it a line-by-line delimited text file, a PHP file containing arrays, etc?

Here's how my file will look:

1|John|Photoshop,Illustrator
2|Katie|Coding,PHP,CSS,HTML
3|Adam|Illustration
4|Carly|Developer



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum