Generic $_GET validator
<p>I want a dead simple generic $_GET-vars validator, and don't have any desire to reinvent the wheel.</p>

<p>Is there any solid and simple script I can use, something like:</p>

<pre><code>function secure($varName,$format = 'int') {
//format: boolean,int,dec,str,date
    //add stripslashes if mq
    $var = $_GET[$varName];
switch($format) {
  case 'int':
    $r = floor($var);
    break;
  case 'boolean':
    $r = ($var === true);
    break;
  case 'dec':
    $r = preg_replace("/0-9.-/i", "", $val);
    break;
  case 'str':
    ..
  case 'date':
    //ISO 8601 is enough...
}  
</code></pre>

<p>regards,
//t</p>
