<?php
  function sanitizeString($var)
  {
    if (get_magic_quotes_gpc())
    $var = stripslashes($var);
    $var = strip_tags($var);
    $var = htmlentities($var);

    return $var;
  }

  function sanitizeMySQL($connection, $var)
  { // Z użyciem rozszerzenia mysqli
    $var = $connection->real_escape_string($var);
    $var = sanitizeString($var);
    return $var;
  }
?>