<?
include "conn.php";
include "security.php";

$action = sec_cleanTAGS($_POST["action"]);
$action = sec_addESC($_POST["action"]);

$action_alias = sec_cleanTAGS($_POST["action_alias"]);
$action_alias = sec_addESC($action_alias);

$color = sec_cleanTAGS($_POST["color"]);
$color = sec_addESC($color);

$other_color = sec_cleanTAGS($_POST["other_color"]);
$other_color = sec_addESC($other_color);

if ($color != $other_color and $color == "other")
	$color = $other_color;

$sql = "SELECT action_name FROM action_config WHERE action_name = '$action' ";
$result = mysql_query($sql);

$rowCheck = mysql_num_rows($result);
if($rowCheck > 0){
	$sql = "UPDATE action_config SET action_alias = '$action_alias', color = '$color' WHERE action_name = '$action' ";
	$conn = mysql_query($sql);
} else {
	$sql = "INSERT INTO action_config (action_name,action_alias , color) VALUES ('$action','$action_alias','$color')";
	$conn = mysql_query($sql);
}

header("Location: action_config_list.php"); 


?>