<?php
session_start();
require('45789417/ref4780.php');
if (!isset($_SESSION['userid'])) {
  echo "<script language='Javascript'> location.href='login.php';</script>";
    exit();
  };
if ($_SESSION['type_user_live'] == "Paciente") {
   	echo "<script type='text/javascript'>  
	window.location='paci_virtual/index.php';
	</script>";
    }
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8"> 
<title>Historia Clínica, Clínica Los Robles</title>
</head>
<body>
<?php
$id = $_POST['id'];
$n_control =  $_POST['n_control'];
$obser = $_POST['obser'];
$peso_actual = $_POST['peso_actual'];
$porc_redu = $_POST['porc_redu'];
$positivo = $_POST['positivo'];
$negativo = $_POST['negativo'];
$ct_abdomen_alto = $_POST['ct_abdomen_alto']; 
$ct_abdomen_medio = $_POST['ct_abdomen_medio']; 
$ct_abdomen_bajo = $_POST['ct_abdomen_bajo']; 
$ct_brazo_right = $_POST['ct_brazo_right']; 
$ct_brazo_left = $_POST['ct_brazo_left'];
$ct_imc = $_POST['ct_imc'];
$ct_porc_agua = $_POST['ct_porc_agua'];
$ct_porc_masamuscular = $_POST['ct_porc_masamuscular'];
$ct_porc_masaosea = $_POST['ct_porc_masaosea'];
$ct_porc_grasa= $_POST['ct_porc_grasa'];
$ct_pierna_right = $_POST['ct_pierna_right'];
$ct_pierna_left = $_POST['ct_pierna_left'];
$ct_exa_ta = $_POST['ct_exa_ta'];
$ct_exa_fc = $_POST['ct_exa_fc']; 
$ct_exa_fr = $_POST['ct_exa_fr']; 
$query = mysqli_query($con,"UPDATE hc_control1 SET obser='$obser', peso_actual='$peso_actual', porc_redu='$porc_redu', positivo='$positivo', negativo='$negativo',ct_abdomen_alto='$ct_abdomen_alto', ct_abdomen_medio='$ct_abdomen_medio', ct_abdomen_bajo='$ct_abdomen_bajo', ct_brazo_right='$ct_brazo_right', ct_brazo_left='$ct_brazo_left', ct_imc='$ct_imc', ct_porc_agua='$ct_porc_agua', ct_porc_masamuscular='$ct_porc_masamuscular', ct_porc_masaosea='$ct_porc_masaosea', ct_porc_grasa='$ct_porc_grasa', ct_pierna_right='$ct_pierna_right', ct_pierna_left='$ct_pierna_left', ct_exa_ta='$ct_exa_ta', ct_exa_fc='$ct_exa_fc', ct_exa_fr='$ct_exa_fr'  WHERE id = '$id' and n_control = '$n_control' ");

$pres = $_POST['pres'];
if( $_POST['pres'] != ""){
	$query = mysqli_query($con,"UPDATE hc_control1 SET pres='$pres' WHERE id = '$id' and n_control = '$n_control' ");
}
/* update cita  CMA*/
$update_cma = mysqli_query($con,"SELECT id,cc FROM hc_paciente WHERE id = '$id'");
	$reg = mysqli_fetch_assoc($update_cma);
		$cc = $reg['cc'];
$query = mysqli_query($con,"UPDATE se_evenement SET CMA='2' WHERE title = '$cc'");
echo "<script language='Javascript'> location.href='result.php?id=$id';</script>";
?>
</body>
</html>