Illegal data processing _php Foundation for GET or post commit value

Source: Internet
Author: User
Tags chr explode

Illegal data processing <?php of GET or post commit value

//********************************************************
--Program Name: Strswap V1.01
--Program writing: [Email]cngift@163.com[/email]
--Completed: 2002-8-1
--Program Purpose: illegal data processing of Get or post submission value
--Note: This program needs to be loaded before all programs are processed for automatic
--substitution of variables used in the program
--Due to the discovery of a serious bug emergency upgrade
--Copyright by Cngift 2002
//********************************************************

Class strswap{

Connectors used to connect variables when a variable is submitted in a get way
var $GetSplitStr = "&&";
var $TempArray = array ();
var $VariableArray = array ();

//********************************************************
--Program Name: Main ()
--Program Purpose: The default mode of operation of this class
--Incoming parameters: None
//********************************************************

function Main () {

Global $REQUEST _method;
if ("get" = = $REQUEST _method) {

$this->subgetstrtoarray ();

}
if ("POST" = = $REQUEST _method) {

$this->subpoststrtoarray ();

}

$this->globalvariable ();



}

//********************************************************
--Program Name: Subgetstrtoarray ()
--Program Purpose: The method that is invoked when a variable is committed in a get way
--Incoming parameters: None
//********************************************************

function Subgetstrtoarray () {

Global $QUERY _string;
$this->temparray = explode ($this->getsplitstr, $QUERY _string);

For ($i =0 $i <sizeof ($this->temparray); $i + +) {

$temp = explode (' = ', $this->temparray[$i]);
$this->variablearray[$i][0] = $temp [0];
$this->variablearray[$i][1] = $this->strreplace ($temp [1]);

}

}

//********************************************************
--Program Name: Subpoststrtoarray ()
--Program Purpose: The method that is invoked when a variable is submitted as a post
--Incoming parameters: None
//********************************************************

function Subpoststrtoarray () {

Global $_post;
Reset ($_post);
for ($i =0; $i <count ($_post); $i + +) {

$this->variablearray[$i][0] = key ($_post);
$this->variablearray[$i][1] = $this->strreplace ($_post[key ($_post)));
Next ($_post);
}

}

//********************************************************
--Program Name: Strreplace ()
--Program Purpose: replacing illegal characters in a variable
--Incoming argument: variable value
//********************************************************

function Strreplace ($STR) {

$str = Stripslashes ($STR);
$STR = Str_replace (CHR), ", $str";
$STR = Str_replace (CHR), ', $str ';
$STR = Str_replace (CHR) Chr (a), "<br>", $str);
$str = Str_replace (' < ', ' < ', $str);
$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);

}

//********************************************************
--Program Name: GlobalVariable ()
--Program Purpose: Declaring variables as global variables to facilitate other programs to call
--Incoming parameters: None
//********************************************************

function GlobalVariable () {

For ($i =0 $i <sizeof ($this->variablearray); $i + +) {

Global $ $this->variablearray[$i][0];
${$this->variablearray[$i][0]} = $this->variablearray[$i][1];

}

}

}

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.