Re: Re: mysql input
| From: | Nathan Rixham | Date: | Tue, 19 Feb 2008 11:25:39 +0000 |
| Subject: | Re: Re: mysql input | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-269603@lists.php.net to get a copy of this message | ||
Nathan Rixham wrote:
Zoltán Németh wrote:apologies! a slight correction for nihilism (the class does work..) usage: $unfucker = new MySqlCommandUnFucker; $sql = "INSERT INTO tablename (varcol) VALUES ('"; $sql .= $unfucker->unFuck($myfuckedvariable); $sql .= "')";2008. 02. 19, kedd keltezéssel 11.03-kor Nathan Rixham ezt írta:<?php class MySqlCommandUnFucker { public function _unfucker($toUnFuck) { if(function_exists('get_magic_quotes_gpc')) { if (get_magic_quotes_gpc()) {Richard Heyes wrote:as I remember its also in SPL. $whatever = new MySqlCommandUnFucker($command); $whatever->unFuck(); :D greets Zoltán NémethShawn McKenzie wrote:it's been depricated I heard in favour of unfuck();nihilism machine wrote:Hrmph, I can't seem to find that in the manual...I have a user saving a VARCHAR(255) field in a mysql db which has single quotes in the text, how can i replace them so that they dont fuck up my mysql command? -eHave you tried: dont_fuck_up_my_mysql_command()$in = stripslashes($toUnFuck);} } return $in; }public function unFuck($fucked) {if(function_exists('mysql_real_escape_string')) { return mysql_real_escape_string($this->_unfucker($fucked)); } else { return $fucked; } } } ?> usage: $unfucker = new MySqlCommandUnFucker; $sql = $unfucker ->unFuck($sql); :)