찾다
php教程php手册Get或Post提交值的非法数据处理

Get或Post提交值的非法数据处理

Jun 13, 2016 pm 12:44 PM
getphppost제출하다데이터 처리~의프로그램


Get或Post提交值的非法数据处理
//********************************************************
//-- 程序名称:StrSwap V1.01
//-- 程序编写:[email]cngift@163.com[/email]
//-- 完成: 2002-8-1
//-- 程序用途:Get或Post提交值的非法数据处理
//-- 备注: 本程序需要加载在所有程序处理前使用,以便自动进行
//-- 程序中使用的变量的替换
//-- 由于发现严重BUG紧急升级
//-- Copyright By cngift ◎ 2002
//********************************************************

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]);

}

}

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

function SubPostStrToArray(){

global $_POST;
reset($_POST);
for($i=0;$i
$this->VariableArray[$i][0] = key($_POST);
$this->VariableArray[$i][1] = $this->StrReplace($_POST[key($_POST)]);
next($_POST);
}

}

//********************************************************
//-- 程序名称:StrReplace()
//-- 程序用途:替换变量中的非法字符
//-- 传入参数:变量值
//********************************************************

function StrReplace($str){

$str = StripSlashes($str);
$str = str_replace(chr(92),'',$str);
$str = str_replace(chr(47),'',$str);
$str = str_replace(chr(10).chr(13),"
",$str);
$str = str_replace('$str = str_replace('>',">",$str);
$str = str_replace(';',";",$str);
$str = str_replace('"',"“",$str);
$str = str_replace("'","‘",$str);
$str = str_replace(" "," ",$str);
$str = str_replace("/**/"," ",$str);

return trim($str);

}

//********************************************************
//-- 程序名称:GlobalVariable()
//-- 程序用途:声明变量为全局变量方便其他程序调用
//-- 传入参数:无
//********************************************************

function GlobalVariable(){

for($i=0;$iVariableArray);$i++){

global $$this->VariableArray[$i][0];
${$this->VariableArray[$i][0]} = $this->VariableArray[$i][1];

}

}

}

?>

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

맨티스BT

맨티스BT

Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

SublimeText3 Linux 새 버전

SublimeText3 Linux 새 버전

SublimeText3 Linux 최신 버전

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기