내가 가진이 개 질문SQL 주입 검사와 PHP를 던져 오류
다음 코드를 (가 삽입 방법으로 확인을 작동하는 것 같다) SQL 주입에 대해
방법을 연습하는 좋은 방법입니다 것 대신에 전체 예에서이 오류 메시지가 : 여기
if (!mysqli_query($query,$link)) { die('Error: ' . mysqli_error()); }
전체 예입니다 :
<?php
$link = mysqli_connect("localhost","root","", "runtracker");
if (!$link)
{
die('Could not connect: ' . mysqli_error());
}
$query="INSERT INTO userinfo (UserName) VALUES (?)";
if ($stmt = mysqli_prepare($link, $query)) {
// Lets create the variables
$name = $_POST['UserName'];
// Bind the variables and execute the query
mysqli_stmt_bind_param($stmt,"s", $name);
mysqli_stmt_execute($stmt);
// And now we close the statement
mysqli_stmt_close($stmt);
}
echo "1 record added";
mysqli_close($link);
?>
이 경우, 정확히, 당신은 SQL 주입으로부터 자신을 보호하기 위해 어떤거야? –
@JackManey, 그는 준비된 성명서를 사용하고 있습니다. – Charles