PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
bob_the _builder
Forum Contributor
Posts: 131 Joined: Sat Aug 28, 2004 12:25 am
Post
by bob_the _builder » Tue Sep 12, 2006 11:34 pm
Hi,
Does that mean doing something like:
Code: Select all
function ValidateInput($value) {
$BBCode = array(
"<b>" => "[b]",
"</b>" => "[/b]",
"<u>" => "[u]",
"</u>" => "[/u]",
);
$value = htmlentities($value);
$value = str_replace(array_keys($BBCode), array_values($BBCode), $value);
$value = mysql_real_escape_string(trim(strip_tags($value)));
return $value;
}
adding:
$value = htmlentities($value);
Prior to using string replace on $value?
Thanks
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Sep 12, 2006 11:37 pm
similar, yes. You'll need to also run your needles through it too (or preprocess them.)
bob_the _builder
Forum Contributor
Posts: 131 Joined: Sat Aug 28, 2004 12:25 am
Post
by bob_the _builder » Wed Sep 13, 2006 12:19 am
Hi,
needles?
Does htmlentities() have to be reversed when calling from the database?
Thanks
Last edited by
bob_the _builder on Wed Sep 13, 2006 12:46 am, edited 1 time in total.
RobertGonzalez
Site Administrator
Posts: 14293 Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA
Post
by RobertGonzalez » Wed Sep 13, 2006 12:41 am
Like the
strpos() function, you are looking for a $needle within $haystack.
bob_the _builder
Forum Contributor
Posts: 131 Joined: Sat Aug 28, 2004 12:25 am
Post
by bob_the _builder » Wed Sep 13, 2006 12:52 am
Hi,
Yep just found that .. What exactly am I looking for (matching) in the url?
Thanks