이 코드를 사용할 때 안전하지 않으므로 코드에 아무 것도 추가 할 수 없습니까?SQL 인젝션으로 코드를 안전하게 만들 수있는 방법
제가 직접 SQL 주입에 대해 많은 지식을 갖고 있지는 않지만 어딘가에서 작동하는 자체 SQL 주입을 시도했습니다. 하지만 해커가 더 똑똑해서 내 웹 사이트를 정말로 해킹 할 수 있습니다.
URL은 다음과 같습니다
http://example.com/profile.php?userID=1
PHP
$userID = $_GET['userID'];
$userID = mysql_real_escape_string($userID);
$CheckQuery = mysql_query("SELECT * FROM tbl_user WHERE id='$userID'");
$CheckNumber = mysql_num_rows($CheckQuery);
if ($CheckNumber !== 1)
{
header("Location: tos.php");
}
내가 시도 : 사이트에 많은 일을 숨길
http://example.com/profile.php?userID=1'
. 내가
http://example.com/profile.php?userID=1' UNION SELECT * FROM tbl_user; with havij it was hacked
감사를 시도
: |
가능한 중복 http://stackoverflow.com/q/60174/1920232 – peterm
내가 그것을 확인과 중복되지 – deerox
당신이'HTTP를 시도하는 경우 : //example.com/profile.php? userID = 0' - 너무 많은 것을 숨길 것인가? –