Php regular expression method? Php ** Tochangethislicenseheader, response. * Tochangethistemplatefile, chooseTools | Templates * andopenthetemplateintheeditor. *** Descriptionofchecksql ** @ autho
Php regular expression method? 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 Regular Expression Method
/*
* 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 ); // The character to be matched
If ($ checkurl)
{
Echo "script" alert ('use invalid characters! Please access the Internet in a civilized way. '); location. href = ''http://www.mps.gov.cn/n16/n1966474/###script》;
Exit ();
} Else
{
Return $ get;
}
}
}
Call Method
Require_once 'url/checksql. php'; // based on your path
$ Check = new checkURL (); // create an object
$ Id = $ check-> inject_check ($ _ GET ['id']); // you can call the regular method by passing url parameters.
After the parameter $ id is matched, you can pass in the custom method.
If you have any questions about the above methods or other better comments and suggestions, please share them with us.