meta characters filtering
- From: Pasquale <spdrweb@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 31 Oct 2005 07:00:34 GMT
I have set up a registration for an event where captains can input and update their team information. I need to allow certain meta characters for their team names, such as ?, ', #, (), &.
With magic_quotes_gpc ON I still cannot insert into the database the single quote (') within a teamname without using addslashes. I receive a mysql error. The PHP manual says not to use addslashes when magic_quotes_gpc is ON, but it doen't work unless I do.?
### filter I use for characters
function Filter ($valu) {
if (isset($valu) && $valu != "") {
$searchB = array ('~','`','!','@','%','^','*','_','+','=','{','}','[',']','|',':',';','"','<','>','/','\\');
$searchG = array ('#','-',',','.','$','(',')','?','\'','&');
foreach ($searchB as $bad) {
$valu = str_replace($bad,'',$valu);
}
foreach ($searchG as $good) {
$valu = str_replace($good,addslashes($good),$valu);
}
$valu = preg_replace("'\s+'"," ",$valu);
}
return $valu;
}
Pasquale
.
- Prev by Date: Re: Inserting PHP5 and HTML code into MySQL
- Next by Date: Re: Trouble with sending multipart Email
- Previous by thread: phpBB sites hacked.
- Next by thread: Help with ports
- Index(es):