如果用户输入未经修改而插入到SQL查询中,则该应用程序易受SQL注入的影响,如下例所示:
$unsafe_variable = $_POST['user_input'];
mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");这是因为用户可以输入类似的东西value'); DROP TABLE table;--,查询变成:
INSERT INTO `table` (`column`) VALUES('value'); DROP TABLE table;--')可以做些什么来防止这种情况发生?
安卓软件程序开发入门学习
seth-shi
慕仔3118017
随时随地看视频慕课网APP