<?php
include("config.php");
include("secure.php");
$db = mysql_connect($host, $userdb, $pwd);
if ($db == FALSE)
die ("Error to connection. Verify the parameters in the file config");
mysql_select_db($dbname, $db)
or die ("Error! database is not selected.");

switch($type){

case 1:
$query = "UPDATE u_msg_dest SET stato=0 WHERE id_msg=$id";
break;

case 2:
$query = "UPDATE t_msg SET stato=0 WHERE id_msg=$id";
break;
}
if (mysql_query($query, $db)){
header("Location: mess-in.php");


}
else{
echo "error during the cancellation";

}
mysql_close($db);

header("Location: mess-in.php");

?>