가능한 중복 :
Best way to prevent SQL Injection in PHPpdo 보안을 위해 일반 sql PHP 코드를 변경하는 방법은 무엇입니까?
는 PDO로 변경 할 필요가 있는가 내가 mysql_real_escape_string를 사용하고 있기 때문에이 코드 안전하며 strip_tags? 다음 코드를 헤더를 수정할 수 없으므로 pdo로 변환 할 수 없습니다.
<?php
include('config.php');
$link =mysql_connect($db_host,$username,$password);
mysql_select_db($db_name);
$id= $_POST["uniqi"];
$comments= $_POST["comments"];
$comments= mysql_real_escape_string($comments);
$comments = strip_tags($comments);
$update = "UPDATE mastertable SET comments = '$comments' WHERE id_pk= '$id'";
mysql_query($update, $link);
mysql_close();
header('Location: http://www.xxxx.com/xxxxx/xxxx.php?cntmsg=Comment Updated');
?>
당신은 확실히 PDO로 변환해야합니다 - mysql 확장 기능은 (http://news.php.net/php.internals/53799) 사용되지 않습니다. – DCoder
http://stackoverflow.com/questions/8028957/headers-already-sent-by-php – PeeHaa