Class CheckPost {
public static function check() {
foreach($_POST as $key => $value)
{
unset($_POST[$key]);
$key = mysql_escape_string( htmlspecialchars( strip_tags($key)));
switch(gettype($value))
{
case 'integer':
$_POST[$key] = intval($value);
break;
case 'string':
$_POST[$key] = mysql_escape_string( htmlspecialchars( strip_tags($value)));
break;
}
if (is_null($value) || $value == '' || empty($value)) {
unset($_POST[$key]);
}
}
}
}
$keyPreg = "/[A-Za-z0-9]+/";
$key = preg_match($keyPreg, $key);