<?php
include('include/entete.php');
include('include/entete_cfa.php');

if(!isset($_GET['id']) || empty($_GET['id'])){
	header('location:index-cfa.php');
	exit();
}

$id=$_GET['id'];
include('config/config.inc.php');
$query="select * from capitaines where id_cap=:id_cap";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':id_cap', $id, PDO::PARAM_INT );
$queryRequest->execute();
if($queryRequest->rowCount()==0){
	header('location:index-cfa.php');
	exit();
}


include('config/lib.inc.php');
$maCleDeCryptage = getCleDeCryptage();
$data=$queryRequest->fetchAll();
$nom_cap=decrypter($maCleDeCryptage,$data[0]['nom_cap']);
$prenom_cap=decrypter($maCleDeCryptage,$data[0]['prenom_cap']);
$email_cap=decrypter($maCleDeCryptage,$data[0]['email_cap']);

$query="select * from equipes where num_capitaine=:id_cap";
$db = connect_base();
$queryRequest = $db->prepare( $query );
$queryRequest->bindParam( ':id_cap', $id, PDO::PARAM_INT );
$queryRequest->execute();
$data=$queryRequest->fetchAll();
$nom_ele=decrypter($maCleDeCryptage,$data[0]['nom_eleve']);
$prenom_ele=decrypter($maCleDeCryptage,$data[0]['prenom_eleve']);
$nom_pro=decrypter($maCleDeCryptage,$data[0]['nom_pro']);
$prenom_pro=decrypter($maCleDeCryptage,$data[0]['prenom_pro']);

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>FAFIH - DECIDAY</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/fonctions.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css"><script>
	
</script>
</head>

<body>
	
	<?php include('include/header.php');?>
	
	<div class="container contentPage">
	
			<div class="titreEtat">Détails trinôme :</div>
			<div class="labFrm">Nom capitaine:</div>
			<div><?php echo $nom_cap;?></div><br />
			<div class="labFrm">Prénom capitaine:</div>
			<div><?php echo $prenom_cap;?></div><br />
			<div class="labFrm">Email capitaine:</div>
			<div><?php echo $email_cap;?></div><br /><br />
			<div class="labFrm">Nom élève:</div>
			<div><?php echo $nom_ele;?></div><br />
			<div class="labFrm">Prénom élève :</div>
			<div><?php echo $prenom_ele;?></div><br /><br />
			<div class="labFrm">Nom professionnel:</div>
			<div><?php echo $nom_pro;?></div><br />
			<div class="labFrm">Prénom professionnel :</div>
			<div><?php echo $prenom_pro;?></div><br />
			<div class="btnDeci"><a href="index-cap.php">Retour</a></div>						
	</div>
	
	<?php include('include/footer.php');?>

</body>
</html>