Basic Data Securing

Secures every data available within the POST & GET From XSS & SQL injection.
of course to run the clean() function the script myst be connected to a database, in order for the mysql_real_escape_string() function to work
Putting this snippet at the top of the page will do the job.
so we don't have to add the clean function to evry single variable ouselves

// cleaning function
// of course. the script must be connected to a database.
function clean($data){ 
   return mysql_real_escape_string( htmlentities( $data ) );
// start filtering $_POST, $_GET and secure any data within
$data = array_merge($_POST, $_GET);
foreach( $data AS $key => $val )
   $data[ $key ] = clean( $val );