<?php
class Request
{
	var $getval 	= array();
	var $postval 	= array();
	var $reqval 	= array();
	//var $serverval 	= array();
	
	function Request()
	{
		//var_dump($_REQUEST);
		$this -> getval  = $this -> funReq($_GET);
		$this -> postval = $this -> funReq($_POST);
		$this -> reqval  = $this -> funReq($_REQUEST);
		//var_dump($this -> reqval);
		//unset($_POST);
		//var_dump($this -> getval);
		//unset($_GET);
	}
	
	function funpost( $keystr = '' )
	{
		if($keystr)
		{
			if(is_array($this -> postval[$keystr]))
			{
				return $this -> postval[$keystr];
			}else{
			
				return trim( $this -> postval[$keystr] );
			}
		}else{
			return false;
		}
	}
	
	function funReq( $getArray = array() )
	{
		//
		foreach( $getArray as $gkey => $gval )
		{
			$getArray[$gkey] = $this -> delExtstr($gval) ;
		}
		return $getArray;
	}
	
	function delExtstr($val)
	{
		//var_dump($val);
		if(is_array($val))
		{
			foreach( $val as $k => $v )
			{

				$val[$k] =  $this -> delExtstr($v);
			}
		}else{
			$val = $this -> delStrWord( $val );
		}
		return  $val ;
	}
	
	//非法字符删除（适用与非文本）
	function delStrWord( $keyWord )
	{
		 $delstr=array('*','^','%','$','#', '`');
		 return str_replace($delstr,'',trim($keyWord)); 
	}
}
$Reque = new Request();
?>