自定义防SQL注入函数
/************************************************
*SQL防注入函数
*@time 2014年6月24日18:50:59
*
*/
public function safe_replace($string){
$string = str_replace('%20','',$string);
$string = str_replace('%27','',$string);
$string = str_replace('%2527','',$string);
$string = str_replace('*','',$string);
$string = str_replace('"','"',$string);
$string = str_replace("'",'',$string);
$string = str_replace('"','',$string);
$string = str_replace(';','',$string);
$string = str_replace('<','<',$string);
$string = str_replace('>','>',$string);
$string = str_replace("{",'',$string);
$string = str_replace('}','',$string);
$string = str_replace("or","",$string);
$string = str_replace("=","",$string);
$string = str_replace("and","",$string);
$string = str_replace("execute","",$string);
$string = str_replace("update","",$string);
$string = str_replace("count","",$string);
$string = str_replace("chr","",$string);
$string = str_replace("mid","",$string);
$string = str_replace("master","",$string);
$string = str_replace("truncate","",$string);
$string = str_replace("char","",$string);
$string = str_replace("declare","",$string);
$string = str_replace("select","",$string);
$string = str_replace("create","",$string);
$string = str_replace("delete","",$string);
$string = str_replace("insert","",$string);
return $string;
}
自定义防SQL注入函数的更多相关文章
- 防sql注入函数
- golang 防SQL注入 基于反射、TAG标记实现的不定参数检查器
收到一个任务,所有http的handler要对入参检查,防止SQL注入.刚开始笨笨的,打算为所有的结构体写一个方法,后来统计了下,要写几十上百,随着业务增加,以后还会重复这个无脑力的机械劳作.想想就l ...
- 【荐】PDO防 SQL注入攻击 原理分析 以及 使用PDO的注意事项
我们都知道,只要合理正确使用PDO,可以基本上防止SQL注入的产生,本文主要回答以下几个问题: 为什么要使用PDO而不是mysql_connect? 为何PDO能防注入? 使用PDO防注入的时候应该特 ...
- PHP防SQL注入不要再用addslashes和mysql_real_escape_string
PHP防SQL注入不要再用addslashes和mysql_real_escape_string了,有需要的朋友可以参考下. 博主热衷各种互联网技术,常啰嗦,时常伴有强迫症,常更新,觉得文章对你有帮助 ...
- php防sql注入、xss
php自带的几个防止sql注入的函数http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2013/0318/12234.html addslashe ...
- Sqlparameter防SQL注入
一.SQL注入的原因 随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多.但是由于这个行业的入门门槛不高,程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候,没有对 ...
- PHP防SQL注入攻击
PHP防SQL注入攻击 收藏 没有太多的过滤,主要是针对php和mysql的组合. 一般性的防注入,只要使用php的 addslashes 函数就可以了. 以下是一段copy来的代码: PHP代码 $ ...
- 【转载】C#防SQL注入过滤危险字符信息
不过是java开发还是C#开发或者PHP的开发中,都需要关注SQL注入攻击的安全性问题,为了保证客户端提交过来的数据不会产生SQL注入的风险,我们需要对接收的数据进行危险字符过滤来防范SQL注入攻击的 ...
- 回头探索JDBC及PreparedStatement防SQL注入原理
概述 JDBC在我们学习J2EE的时候已经接触到了,但是仅是照搬步骤书写,其中的PreparedStatement防sql注入原理也是一知半解,然后就想回头查资料及敲测试代码探索一下.再有就是我们在项 ...
随机推荐
- [置顶]
kubernetes资源对象--ResourceQuotas
概念 Resource Quotas(资源配额,简称quota)是对namespace进行资源配额,限制资源使用的一种策略. K8S是一个多用户架构,当多用户或者团队共享一个K8S系统时,SA使用qu ...
- ylbtech_dbs_article_五大主流数据库模型
ylbtech_dbs_article 摘要:什么是数据模型? 访问数据库中的数据取决于数据库实现的数据模型.数据模型会影响客户端通过API对数据的操作.不同的数据模型可能会提供或多或少的功能.一般而 ...
- eclipse进行Debug的时候,发出“java breakpoint unable to install breakpoint”错误
错误情况图: 问题的解决方法: 直接点击忽略掉:Don't tell me again 来自网上的答案~~ I had the same error message in Eclipse 3.4.1, ...
- tensorflow TensorArray 代码例子
import tensorflow as tf import numpy as np B=3 D=4 T=5 tf.reset_default_graph() xs=tf.placeholder(sh ...
- 关于container_of和list_for_each_entry 及其相关函数的分析
Linux代码看的比较多了,经常会遇到container_of和list_for_each_entry,特别是 list_for_each_entry比较多,因为Linux经常用到链表,虽然知道这些函 ...
- asp.net显示评论的时候为几天前的格式
自己做的一个小项目实现的功能,做个记录先~ 效果如图: 代码如下: public static class TimerHelper { public static string GetTimeSpan ...
- python langid实现语种识别
2017-04-26 语料数据入库时有个小需求,需要用一个字段存储语料的语种,偶然发现langid可以实现这一功能,再次感叹python的好用! #coding=utf-8 import langid ...
- fiddler实现后端接口 mock(不需要修改开发代码)
转载:http://blog.csdn.net/huazhongkejidaxuezpp/article/details/50435552 步骤 1. 获取 接口 定义(接口返回的json串) ...
- Solidworks如何在装配图中保存单独的一个零件
如下图所示,我想要保存装配体的一个单独的零部件 选中该零件后点击编辑零部件 然后点击顶部的文件-另存为,弹出"解决模糊情形"对话框,询问你要保存装配体还是零部件 点击确 ...
- Git提交时提示‘The file will have its original line endings in your working directory’
Git提交时提示'The file will have its original line endings in your working directory' Git出现错误 git add -A ...