<? Php
//************************************** ******************
// -- Program name: StrSwap V1.0
// -- Program purpose: illegal data processing of the value submitted by Get or Post
// -- Note: This program needs to be loaded before all programs are processed for automatic
// -- Replace the variables used in the program
//************************************** ******************
Class StrSwap {
// The connector used to connect variables when you submit variables in Get Mode
Var $ GetSplitStr = "&&";
Var $ TempArray = array ();
Var $ VariableArray = array ();
//************************************** ******************
// -- Program name: Main ()
// -- Program purpose: the default running mode of this class
// -- Input parameter: 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 called when the variable is submitted in Get mode.
// -- Input parameter: 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]);
}
}