0
我想通過tinymce插入html。pdo insert in url
例如:
<img title="q" src="../kcfinder/upload/image/3b5330574c883fe1040eaddeb596ea20.jpg" alt="q" width="640" height="480" />
的PDO使得這個
<img title=\"q\" src=\"../../../kcfinder/upload/image/3b5330574c883fe1040eaddeb596ea20.jpg\" alt=\"q\" width=\"640\" height=\"480\" />
這是insertAction:
$data = array_slice($data1, 0, -1);
foreach ($data as $column => $value) {
$ins[] = ':' . $column;
}
$ins = implode(',', $ins);
$fields = implode(',', array_keys($data));
$sql = "insert into $this->tableName ($fields) values ($ins)";
$sth = $this->connection->getConnection()->prepare($sql);
foreach ($data as $f => $v) {
$sth->bindValue(':' . $f, $v);
}
return $sth->execute();
我試過str_replace函數,但是,這並不工作。 有人想法如何刪除\?
解決方案:
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}
您的代碼可能容易受到SQL注入 – 2013-05-14 12:56:37
我知道,strip_tags和修剪你的意思? – Bas 2013-05-14 13:02:31
他們都沒有添加斜槓 – 2013-05-14 13:05:05