0
나는 tinymce로 html을 삽입하려고합니다. 예를 들어pdo 삽입이 URL에 있음
:
$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를 시도했지만 그 나던 작업 :
는<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입니다. 누군가가 \을 제거하는 방법에 대한 아이디어가 있습니까?
솔루션 :
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 인젝션에 취약 할 가능성이 높음 –
strip_tags와 trim을 사용한다는 의미입니까? – Bas
그들 중 어느 쪽도 슬래시를 추가하지 않았습니다. –