title: The ultimate clean/secure function
body: <p>I have a lot of user inputs from <code>$_GET</code> and <code>$_POST</code>... At the moment I always write <code>mysql_real_escape_string($_GET['var'])</code>..</p>
  
  <p>I would like to know whether you could make a function that secures, escapes and cleans the <code>$_GET</code>/<code>$_POST</code> arrays right away, so you won't have to deal with it each time you are working with user inputs and such.</p>
  
  <p>I was thinking of an function, e.g <code>cleanMe($input)</code>, and inside it, it should do <code>mysql_real_escape_string</code>, <code>htmlspecialchars</code>, <code>strip_tags</code>, <code>stripslashes</code> (I think that would be all to make it clean &amp; secure) and then return the <code>$input</code>.</p>
  
  <p>So is this possible? Making a function that works for all <code>$_GET</code> and <code>$_POST</code>, so you would do only this:</p>
  
  <pre><code>$_GET  = cleanMe($_GET);
  $_POST = cleanMe($_POST);
  </code></pre>
  
  <p>So in your code later, when you work with e.g <code>$_GET['blabla']</code> or <code>$_POST['haha']</code> , they are secured, stripped and so on?</p>
  
  <p>Tried myself a little:</p>
  
  <pre><code>function cleanMe($input) {
     $input = mysql_real_escape_string($input);
     $input = htmlspecialchars($input, ENT_IGNORE, 'utf-8');
     $input = strip_tags($input);
     $input = stripslashes($input);
     return $input;
  }
  </code></pre>