RE: [PEAR] MDB2 autoExecute escaping data

From: Date: Mon, 08 Oct 2007 09:16:43 +0000
Subject: RE: [PEAR] MDB2 autoExecute escaping data
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28073@lists.php.net to get a copy of this message
Why isn't it a good idea to be running htmlentities on the data before hand? It is raw HTML, if that makes any difference. Thanks, Mark -----Original Message----- From: Justin Patrin [mailto:papercrane@gmail.com] Sent: Monday, October 08, 2007 5:48 AM To: Christian Schmidt Cc: pear-general@lists.php.net Subject: Re: [PEAR] MDB2 autoExecute escaping data On 10/7/07, Christian Schmidt <pear.php.net@chsc.dk> wrote: > Mark Steudel wrote: > > I think I'm checking for that, here's the code I am running: > > > > // convert to html entities > > $html = htmlentities( $_POST['content'], ENT_QUOTES ); > > > > // check if magic quotes gpc is on, remove slashes > > if( get_magic_quotes_gpc() ) > > { > > $data = stripslashes( $html); > > } > Generally, you should call stripslashes() before anything else, i.e. > before htmlentities(). > Then again you really shouldn't be running htmlentities on data you're insertinng into the DB in the first place. -- Justin Patrin -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.general (#28073) next »