php代码防止mysql注入的方式

怎么用php代码来防止mysql注入(最好用正则模式)方法越多越好,先谢谢大家了

Username:

Password:

试试这个表单吧

sql预编译的就能防止

http://blog.csdn.net/qq_26291823/article/details/50460625
http://www.jb51.net/article/36042.htm
http://www.2cto.com/article/201306/217561.html

关键字的过滤
pdo预处理
php 配置文件 php.ini 中的 magic_quotes_gpc选项没有打开,被置为 off
addslashes stripslashes
mysql_real_escape_string
对一些数据类型做强制的校验