<?

class request
{
    var 
$array_level 3//only 3 level arrays accepted for security reasons (change to your needs)
    
    
function request()
    {
        
$this->isPost = (!empty($_POST));
        
$this->isGet = (!empty($_GET));
        
        
$this->files = (array)$_FILES;
        
$this->data array_merge((array)$_GET, (array)$_POST);
        
//  magic quotes normalization 
        
if (get_magic_quotes_gpc())
        {
            function 
strip_quotes(&$var$key$user)
            {
                if (
$user['i']>$user['level'])
                {
                    
$var NULL;
                    return;
                }
                
                if (
is_array($var))
                {
                    
array_walk($var'strip_quotes', array('i' => $user['i']+1'level' => $user['level']));
                }
                else
                {
                    
$var stripslashes($var);
                }
            }
            
array_walk($this->data'strip_quotes', array('i' => 0'level' => $this->array_level));
        }
    }

    function 
isPost()
    {
        return 
$this->isPost;
    }
    
    function 
isGet()
    {
        return 
$this->isGet;
    }
    
    function 
isRequest()
    {
        return (
$this->isPost || $this->isGet);
    }
    
    function 
getInt($key)
    {
        if (isset(
$this->data[$key])) return (int)$this->data[$key];
        else return 
0;
    }
    
    function 
getFloat($key)
    {
        if (isset(
$this->data[$key])) return (float)$this->data[$key];
        else return 
0;
    }
    
    function 
getStr($key)
    {
        if (isset(
$this->data[$key])) return (string)$this->data[$key];
        else return 
"";
    }

    function 
getArr($key)
    {
        if (
is_array($this->data[$key])) return (array)$this->data[$key];
        else return array();
    }
}
?>