<?

if($_SESSION['nivel'] == '1'){

	if(count($_GET)>0){
	  while (list($variavelNOME,$variavelGET) = each($_GET)) {
	    $$variavelNOME= $variavelGET;
	  }
	}
	if(count($_POST)>0){
	  while (list($variavelNOME,$variavelPOST) = each($_POST)) {
	    $$variavelNOME= $variavelPOST;
	  }
	}

	if ($_GET[resposta] == 'S'){
		$sql= "delete from crm_agenda where id = '$cod'";
		Echo "<p align='center' style='margin-top:100'><font color='#000066' face='Arial, Helvetica, sans-serif' size='+2'>Compromisso foi exclu&iacute;do com sucesso! </font></p>";
		$result=mysql_query($sql);

	}else{
		$sql= "select codcli, compromisso from crm_agenda where id='$cod'";
		$result=mysql_query($sql);
		Echo "<center><font color='#000066' face='Arial, Helvetica, sans-serif' size='+2'><font color='#FF0000'>ATEN&Ccedil;&Atilde;O!!</font>Deseja excluir o compromisso abaixo?</font><br>";
		$campos= mysql_fetch_array($result);   
		$codcli=$campos["codcli"];

		Echo "<font color='#000066' face='Arial, Helvetica, sans-serif' size='+2'>$campos[compromisso]</font><br>";
		Echo "<a href='miolo.php?miolo=agenda&acao=excluir&cod=$cod&codcli=$codcli&resposta=S'><font color='#000066' face='Arial, Helvetica, sans-serif' size='+1'>Sim</font></a> - ";
		Echo "<a href='miolo.php?miolo=agenda&acao=gerenciar&cod=$codcli'> <font color='#000066' face='Arial, Helvetica, sans-serif' size='+1'>N&atilde;o</font></a>";
		}



}
?>
