<?php 
session_start();
require_once(dirname(__DIR__, 2) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');
$verif_bip_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_retards_bip'"));

if(isset($_SESSION['user_droits'])) {
	$rep = '../../img/wav/'.$prefix;
	$rep_open = opendir($rep);
	$chemin = $rep.'/'.$_REQUEST['file'];
	@unlink($chemin);
	closedir($rep_open);
	if($verif_bip_info['valeur']==$_REQUEST['file']) {
		mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '0' WHERE param_nom = 'freq_retards_bip'");
		mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '0' WHERE param_nom = 'freq_birthday_bip'");
		mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '0' WHERE param_nom = 'freq_nbvisites_bip'");
	}
}
mysqli_close($bdd);
?>