php防流入函数

WBOY
Release: 2016-06-13 11:16:00
Original
866 people have browsed it

php防注入函数

1、 PHP注入的基本原理

程序员的水平及经验也参差不齐,相当大一部分程序员在编写代码的时候,没有对

用户输入数据的合法性进行判断,使应用程序存在安全隐患。用户可以提交一段数据

库查询代码,根据程序返回的结果,获得某些他想得知的数据,这就是所谓的

SQL Injection,即SQL注入。受影响的系统:对输入的参数不进行检查和过滤的系统

//防注入

function inject_check($sql_str) {

  $check= eregi('select|insert|update|delete|'|/*|*|../|./|union|into|load_file

|outfile', $sql_str);     // 进行过滤

  if($check)

  {

   echo ("若水印象网络http://www.ruoshuiyx.com 提示:请勿尝试非法注入");

   exit();

  }

  else

  return $sql_str;

}


使用请看下图

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!