$acao = $_GET["acao"]; $acao2 = $_GET["acao2"]; if ($acao2 == "salva") { $id = $_POST["id"]; $nome = trim($_POST["nome"]); $event = trim($_POST["event"]); $content = trim($_POST["content"]); if ($acao == "inseri") { $query = "INSERT INTO pbx_sip_notify(nome,event,\"content-length\") VALUES ('$nome','$event','$content')"; pg_query($dbcon, $query); } if ($acao == "edita") { //REALIZA BACKUP BO BANCO //($dbcon,'pbx_sip_notify','U',$id,'update','SIP_NOTIFY'); $query = "UPDATE pbx_sip_notify SET nome='$nome', event='$event', \"content-length\"='$content' WHERE id=$id"; pg_query($dbcon, $query); }//gera arquivos e executa o reload dos dados no asterisk gera_arquivos($dbcon, 'SIP_NOTIFY'); ?> } if ($acao == "edita") { $id = $_GET["id"]; $query = "SELECT * FROM pbx_sip_notify where id=$id"; $result = pg_query($dbcon, $query); } else { $query = "SELECT * FROM pbx_sip_notify where id is null"; } $result = pg_query($dbcon, $query); while ($dados = pg_fetch_array($result)) { $id = $dados["id"]; $nome = $dados["nome"]; $event = $dados["event"]; $content = $dados["content-length"]; } ?>