<?php 
session_start();
require_once(dirname(__DIR__, 2) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');
if(isset($_SESSION['user_droits'])) {
	$eval_verif_nb = mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_savele WHERE eleves_id = '".$_REQUEST['eleve']."' AND s_id = '".$_REQUEST['savoir']."'"));
	if($eval_verif_nb==1) {
		mysqli_query($bdd,"UPDATE ".$prefix."_savele SET eval = '".$_REQUEST['note']."' WHERE eleves_id = '".$_REQUEST['eleve']."' AND s_id = '".$_REQUEST['savoir']."'");
	}
	else if($eval_verif_nb==0) {
		mysqli_query($bdd,"INSERT INTO ".$prefix."_savele (eleves_id, s_id, eval) VALUES ('".$_REQUEST['eleve']."', '".$_REQUEST['savoir']."', '".$_REQUEST['note']."')");
	}
}
mysqli_close($bdd);
?>