RE: [PHP] Re: mysql input

From: Date: Tue, 19 Feb 2008 14:47:05 +0000
Subject: RE: [PHP] Re: mysql input
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-269619@lists.php.net to get a copy of this message
thats awesome bastien> To: php-general@lists.php.net> Date: Tue, 19 Feb 2008 11:21:02 +0000> From: bastien> nrixham@gmail.com> Subject: Re: [PHP] Re: mysql input> > Zoltán Németh wrote:> > bastien> 2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:> >> Richard Heyes bastien> wrote:> >>> Shawn McKenzie wrote:> >>>> nihilism machine wrote:> bastien> >>>>> I have a user saving a VARCHAR(255) field in a mysql db which has single> bastien> >>>>> quotes in the text, how can i replace them so that they dont fuck up my> bastien> >>>>> mysql command?> >>>>>> >>>>> -e> bastien> >>>>> >>>> Have you tried: dont_fuck_up_my_mysql_command()> bastien> >>> Hrmph, I can't seem to find that in the manual...> >>>> >> bastien> it's been depricated I heard in favour of unfuck();> >>> > > > as I bastien> remember its also in SPL.> > $whatever = new MySqlCommandUnFucker($command);> > bastien> $whatever->unFuck();> > > > :D> > > > greets> > Zoltán Németh> bastien> > <?php> > class MySqlCommandUnFucker {> > public function _unfucker($toUnFuck) bastien> {> if(function_exists('get_magic_quotes_gpc')) {> if (get_magic_quotes_gpc()) {> bastien> $in = stripslashes($toUnFuck);> }> }> return $in;> }> > public function bastien> unFuck($fucked) {> if(function_exists('mysql_real_escape_string')) {> return bastien> mysql_real_escape_string($this->_unfucker($fucked));> } else {> return $fucked;> }> bastien> }> }> ?>> > > usage:> $unfucker = new MySqlCommandUnFucker;> $sql = bastien> $unfucker ->unFuck($sql);> > :)> > -- > PHP General Mailing List bastien> (http://www.php.net/)> To unsubscribe, visit: bastien> http://www.php.net/unsub.php> _________________________________________________________________

« previous php.general (#269619) next »