php 正则方法 ?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * Description of checksql * * @autho
php 正则方法
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of checksql
*
* @author xt
class checkURL{
function inject_check($get) {
$checkurl=eregi('select|insert|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile|or|and|-||&|%|limit|where|oR|aNd', $get);//要匹配的字符
if($checkurl)
{
echo "<script>alert('使用非法字符!请文明上网,文明上网');location.href='' http://www.mps.gov.cn/n16/n1966474/“;</script>";
exit();
}else
{
return $get;
}
}
}
调用方法
require_once 'url/checksql.php'; //根据自己的路径
$check=new checkURL(); //创建对象
$id=$check->inject_check($_GET['id']); //将url传入的参数 传入调用的正则方法
参数$id 匹配过后可以去传入自定义方法使用
以上方法 如有问题或是其他的更好的意见及建议 欢迎大家一起交流

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

SublimeText3汉化版
中文版,非常好用

Atom编辑器mac版下载
最流行的的开源编辑器