SQL注入-当使用intval()处理变量时是否可能


SQL Injection - is it possible when the variable is processed using intval()?

我有一个很短的问题,但还没有人问。是否可以在这样的代码中进行SQL注入?:

$number = intval($_GET["number"];
mysqli_query($link, "Select Username FROM Users WHERE USER_ID = $number");

谢谢。

感谢使用intval() no,所以您很好。

但是:mysql_query()已弃用(http://php.net/manual/en/function.mysql-query.php)。考虑使用MySQLi或PDO_MySQL。

否,因为intval永远只是一个数字。(int)也是如此。