<?php session_start();
if(!empty($_SESSION['user_connect_id']))
{
require '../config.php';
///// consultation
 if($_GET['type'] == "sup_consult"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql2="DELETE FROM consultations WHERE id= '$id'";
     mysqli_query($con,$sql2);
	}
/// Patients

 if($_GET['type'] == "sup_patient"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql2="DELETE FROM patients WHERE id= '$id'";
     mysqli_query($con,$sql2);
  }
  ///// sup_ord

 if($_GET['type'] == "sup_ord"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql1="DELETE FROM ordonnances WHERE id= '$id'";
     mysqli_query($con,$sql1);
     $sql2="DELETE FROM consultation_ordonnance WHERE id_ord= '$id'";
     mysqli_query($con,$sql2);
     $sql3="DELETE FROM ordonnance_medicament WHERE id_ord= '$id'";
     mysqli_query($con,$sql3);

  }
 ///// sup_medicament

 if($_GET['type'] == "sup_med"){
     $id=mysqli_real_escape_string($con,$_GET['id_med']);
      $sql1="DELETE FROM medicaments WHERE 	id_medicament = '$id'";
     mysqli_query($con,$sql1);
     $sql2="DELETE FROM ordonnance_medicament WHERE id_med= '$id'";
     mysqli_query($con,$sql2);
    

  }
  
  /////// _sup_bilan
  if($_GET['type'] == "sup_bilan"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql1="DELETE FROM bilans WHERE id_bilan= '$id'";
      mysqli_query($con,$sql1);
      $sql2="DELETE FROM consultation_bilan WHERE id_bilan= '$id'";
     mysqli_query($con,$sql2);
	}

if($_GET['type'] == "sup_user"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql2="DELETE FROM users WHERE id= '$id'";
      mysqli_query($con,$sql2);
  }
//////// sup_planning

if($_GET['type'] == "sup_planning"){
     $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql2="DELETE FROM planning WHERE id= '$id'";
      mysqli_query($con,$sql2);
  }
    
if($_GET['type'] == "desact_user"){
      $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql1 = "UPDATE users SET etat='0' where id='$id' ";

      mysqli_query($con,$sql1);
      echo  $id;
    }
if($_GET['type'] == "act_user"){
      $id=mysqli_real_escape_string($con,$_GET['id']);
      $sql1 = "UPDATE users SET etat='1' where id='$id'";
      mysqli_query($con,$sql1);
    }

    }


    ?>