<?

/* OPTION 1 */

//$badWords = "(delete)|(update)|(union)|(insert)|(drop)|(http)|(--)";
$badWords = "(delete)|(update)|(union)|(insert)|(drop)|(--)";

//This stops SQL Injection in POST vars 
foreach ($_POST as $key => $value) { 
  $_POST[$key] = mysql_real_escape_string($value); 
  $_POST[$key] = eregi_replace($badWords, "", $_POST[$key]);
} 

//This stops SQL Injection in GET vars 
foreach ($_GET as $key => $value) { 
  $_GET[$key] = mysql_real_escape_string($value);
  $_GET[$key] = eregi_replace($badWords, "", $_GET[$key]);
} 

/* OPTION 2 (UNUSED, DOESN'T TAKE CARE OF BAD WORDS! */

/*

function mysql_real_escape_array($t){ 
    return array_map("mysql_real_escape_string",$t); 
}  

$_POST=mysql_real_escape_array($_POST);
$_GET=mysql_real_escape_array($_GET);

*/

?>