lietojot tinymce 3.5.8 neizdodas ievadīt datubāzē korektu html kodu
Ja noformēju textu un paskatos sours, sanāk
<h1 style="color: #ff0000;"><span style="font-size: large;">Text <img style="vertical-align: text-top;" src="http://jfoucher.com/uploads/2009/06/mangatar2big.png" alt="" width="150" height="149" /></span></h1>
Man saglabājās
<h1><span>Text <img src="\"http:/jfoucher.com/uploads/2009/06/mangatar2big.png\"" alt="\"\"" width="\"150\"" height="\"149\"" /></span></h1>
Lai apdeitotu lietoju
function qstr($string, $magic_quotes = false) {
if(!$magic_quotes) {
if(strnatcmp(PHP_VERSION, '4.3.0') >= 0) {
return "'" . mysql_real_escape_string($string) . "'";
}
$string = str_replace("'", "\\'" , str_replace('\\', '\\\\', str_replace("\0", "\\\0", $string)));
return "'" . $string . "'";
}
return "'" . str_replace('\\"', '"', $string) . "'";
}
if(isset($_POST['save'])) {
if(mysql_query('UPDATE `about` SET text='.qstr($_POST['text']))) {
$done = true;
}
}
iesaktie kā ir pareizāk!