<?php 
session_start();
require_once(dirname(__DIR__, 2) . '/config.php');
require_once(BASE_PATH . '/db/idl_connect.php');

if(isset($_SESSION['user_droits'])) {
	if($_REQUEST['param']=='sonret') {
		$verif_bip_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_retards_bip'"));
		if($verif_bip_info['valeur']!=$_REQUEST['file']) {
			mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '".$_REQUEST['file']."' WHERE param_nom = 'freq_retards_bip'");
		}
	}
	if($_REQUEST['param']=='sonres') {
		$verif_bip_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_sigb_resabip'"));
		if($verif_bip_info['valeur']!=$_REQUEST['file']) {
			mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '".$_REQUEST['file']."' WHERE param_nom = 'freq_sigb_resabip'");
		}
	}
	else if($_REQUEST['param']=='sonanniv') {
		$verif_bip_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_birthday_bip'"));
		if($verif_bip_info['valeur']!=$_REQUEST['file']) {
			mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '".$_REQUEST['file']."' WHERE param_nom = 'freq_birthday_bip'");
		}
	}
	else if($_REQUEST['param']=='sonvisits') {
		$verif_bip_info = mysqli_fetch_assoc(mysqli_query($bdd,"SELECT valeur FROM ".$prefix."_parametres WHERE param_nom = 'freq_nbvisites_bip'"));
		if($verif_bip_info['valeur']!=$_REQUEST['file']) {
			mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '".$_REQUEST['file']."' WHERE param_nom = 'freq_nbvisites_bip'");
		}
	}
}
mysqli_close($bdd);
?>