php防止sql注入代码实例
时间:2023-08-15 21:17:21
放到公用调用文件(如conn数据库链接文件),对所有GET或POST的数据进行过滤特殊字符串,以实现简单有效的SQL注入过滤
Function inject_check($sql_str) {
return eregi('select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile', $sql_str);
}
if (inject_check($_SERVER['QUERY_STRING'])==1 or inject_check(file_get_contents("php://input"))==1){
//echo "警告 非法访问!";
header("Location: Error.php");
}
标签:防止sql注入
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Golang算法问题之整数拆分实现方法分析
2023-07-01 00:39:36
Sanic框架请求与响应实例分析
2023-05-26 00:07:00
ThinkPHP 3.2 版本升级了哪些内容
2023-09-05 04:22:04
pandas DataFrame 警告(SettingWithCopyWarning)的解决
2023-08-20 07:45:31
prototype.js1.4版开发者手册
2007-09-30 14:09:00
![](https://img.aspxhome.com/file/UploadPic/up/2007093019082399.jpg)
MySQL中一些鲜为人知的排序方式
2024-01-18 03:18:12
![](https://img.aspxhome.com/file/2023/7/103377_0s.jpg)
Python使用captcha库制作带参数输入验证码案例
2022-01-25 20:26:03
![](https://img.aspxhome.com/file/2023/2/95792_0s.jpg)
Django-silk性能测试工具安装及使用解析
2023-12-08 08:53:19
python匿名函数lambda原理及实例解析
2023-01-05 02:55:07
webpack结合express实现自动刷新的方法
2024-04-23 09:12:27
解读Python中的frame是什么
2023-09-26 08:25:50
![](https://img.aspxhome.com/file/2023/3/105753_0s.png)
mysql数据库备份命令分享(mysql压缩数据库备份)
2024-01-22 10:36:57
一段有趣的js代码的研究
2008-04-29 21:47:00
安装PHP遇到“无法载入mysql扩展”解决方法
2007-06-15 15:04:00
解决TensorFlow调用Keras库函数存在的问题
2023-11-20 15:04:25
![](https://img.aspxhome.com/file/2023/4/86464_0s.jpg)
在Linux系统上部署Apache+Python+Django+MySQL环境
2024-01-14 00:51:15
![](https://img.aspxhome.com/file/2023/9/131449_0s.png)
ASP 下载时重命名已上传文件的新下载文件名的实现代码
2012-11-30 20:33:45
python使用UDP实现客户端和服务器对话
2023-03-24 17:59:27
以一段代码为实例快速入门Python2.7
2021-04-24 05:00:06
使用Python实现从各个子文件夹中复制指定文件的方法
2023-11-09 12:04:05