<?php

// rétroaction sur fréquentation avec date_freq différente de la date du code_freq
$check_date = mysqli_query($bdd,"SELECT freq_id, date_freq, code_freq FROM ".$prefix."_freq"); 
foreach($check_date as $chgt_date) {
	if($chgt_date['date_freq']!=substr($chgt_date['code_freq'],0,10)) {
		mysqli_query($bdd,"UPDATE ".$prefix."_freq SET date_freq = '".substr($chgt_date['code_freq'],0,10)."' WHERE freq_id = '".$chgt_date['freq_id']."'");
	}
}

// couleurs pour les codes briques
$allcodes = mysqli_query($bdd,"SELECT * FROM ".$prefix."_edtcode ORDER BY code_id");
$allcodes_nb = mysqli_num_rows($allcodes);
if(mysqli_num_rows(mysqli_query($bdd,"SELECT * FROM ".$prefix."_edtcode WHERE bgcolor_code = ''"))==$allcodes_nb) {
	$color_array = array('#FF9900','#99FF00','#CCFFFF','#FF66FF','#CC6600','#FFFF33','#99CC66', '#003399','#9900FF','#FF0033','#CCCC00','#66CC66','#CCFFFF','#333366','#CC99CC','#330033','#FF6666','#993300','#33CC33','#3399FF');
	$i=0;
	foreach($allcodes as $codecolor) {
		mysqli_query($bdd,"UPDATE ".$prefix."_edtcode SET bgcolor_code = '".$color_array[$i]."' WHERE code_id = '".$codecolor['code_id']."'");
		$i++;
	}
}

// version bdd :
mysqli_query($bdd,"UPDATE ".$prefix."_parametres SET valeur = '0.27' WHERE param_nom = 'version_bdd'");

?>