Illegal data processing for GET or post commit values _php

Source: Internet
Author: User
Keywords illegal filed str program STR_REPL
Illegal data processing for GET or post commit values
//********************************************************
--Program Name: Strswap V1.01
--Program writing: [Email]cngift@163.com[/email]
--Completion: 2002-8-1
--Program use: illegal data processing for GET or post commit values
--Note: This program needs to be loaded before all programs are processed so that it can be automatically
--substitution of variables used in the program
--Due to the discovery of a serious bug emergency upgrade
--Copyright by Cngift 2002
//********************************************************

Class strswap{

The connector used to concatenate variables when a variable is submitted in Get mode
var $GetSplitStr = "&&";
var $TempArray = array ();
var $VariableArray = array ();

//********************************************************
--Program Name: Main ()
--Program use: The default mode of operation for 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 called when a variable is submitted in Get mode
--Incoming parameters: None
//********************************************************

function Subgetstrtoarray () {

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

for ($i =0; $i 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 called when a variable is submitted as a post
--Incoming parameters: None
//********************************************************

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

}

//********************************************************
--Program Name: Strreplace ()
--Program Purpose: Replace illegal characters in variables
--Incoming parameter: variable value
//********************************************************

function Strreplace ($STR) {

$str = Stripslashes ($STR);
$STR = Str_replace (CHR), ', $str);
$STR = Str_replace (CHR), ', $str);
$STR = Str_replace (CHR). chr (13), "
", $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 use: Declaring variables as global variables facilitates other program calls
--Incoming parameters: None
//********************************************************

function GlobalVariable () {

for ($i =0; $i 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.