<? include "verify.php" ?>
<?
include "conn.php";

$action = $_POST["action"];
$id = $_POST["id"];

$name = $_POST["name"];
$log_type = $_POST["log_type"];
$log_action = $_POST["log_action"];
$log_group = $_POST["log_group"];
$severity = $_POST["severity"];
$log_contains = $_POST["log_contains"];
$log_exclude = $_POST["log_exclude"];
$occurrences_number = $_POST["occurrences_number"];
$occurrences_within = $_POST["occurrences_within"];
$criticality = $_POST["criticality"];
$active_email = $_POST["active_email"];
$email = $_POST["email"];

if ($action == "new")
{

$sql = "INSERT INTO alert_config (name, log_type, log_action, log_group, severity, log_contains, log_exclude, occurrences_number, occurrences_within, criticality, active_email, email) 
				VALUES ('$name', '$log_type', '$log_action', '$log_group', '$severity', '$log_contains', '$log_exclude', '$occurrences_number', '$occurrences_within', '$criticality', '$active_email', '$email')";

$conn = mysql_query($sql);
//echo $sql;
} 
else if ($action == "edit")
{
$sql = "UPDATE alert_config SET 
				name = '$name', 
				log_type = '$log_type', 
				log_action = '$log_action', 
				log_group = '$log_group',	
				severity = '$severity', 
				log_contains = '$log_contains', 
				log_exclude = '$log_exclude', 
				occurrences_number = '$occurrences_number', 
				occurrences_within = '$occurrences_within', 
				criticality = '$criticality',
				active_email = '$active_email', 
				email = '$email' 
			WHERE id = $id ";

//echo $sql;

$conn = mysql_query($sql);	
}

header("Location: alert_config_list.php"); 

?>