Home  >  Article  >  php教程  >  非法字符替换程序

非法字符替换程序

WBOY
WBOYOriginal
2016-06-13 10:11:22951browse


//********************************************************
//-- 程序名称:StrSwap V1.0
//-- 程序用途:Get或Post提交值的非法数据处理
//-- 备注: 本程序需要加载在所有程序处理前使用,以便自动进行
//-- 程序中使用的变量的替换
//********************************************************

class StrSwap{

//当以Get方式提交变量时用于连接变量的连接符
var $GetSplitStr = "&&";
var $TempArray = array();
var $VariableArray = array();

//********************************************************
//-- 程序名称:Main()
//-- 程序用途:本类的默认运行方式
//-- 传入参数:无
//********************************************************

function Main(){

global $REQUEST_METHOD;
if("GET"==$REQUEST_METHOD){

$this->SubGetStrToArray();

}
if("POST"==$REQUEST_METHOD){

$this->SubPostStrToArray();

}

$this->GlobalVariable();



}

//********************************************************
//-- 程序名称:SubGetStrToArray()
//-- 程序用途:当变量以Get方式提交时所调用的方法
//-- 传入参数:无
//********************************************************

function SubGetStrToArray(){

global $QUERY_STRING;
$this->TempArray = explode($this->GetSplitStr,$QUERY_STRING);

for($i=0;$iTempArray);$i ){

$temp = explode('=',$this->TempArray[$i]);
$this->VariableArray[$i][0] = $temp[0];
$this->VariableArray[$i][1] = $this->StrReplace($temp[1]);

}

}

Statement:
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