Bon alors j'ai vraiment besoin d'aide là

Voici mon code :
admin_nv_champs.php (nouveau fichier)
function recuperer_champ_position($champ_id)
{
global $champs, $compte_champs;
$error = TRUE;
for ( $i = 0; $i < $compte_champs; $i++ )
{
if ( $champs[$i]['champ_id'] == $champ_id )
{
$error = FALSE;
return $i;
}
}
( $error == TRUE ) ? return FALSE : return TRUE;
}
function supprimer_champ($id)
{
global $bdd, $cache, $champs, $compte_champs, $langue;
$champ_position = recuperer_champ_position($id);
$sql = 'ALTER ' . MEMBRES_TABLE . ' DROP ' . $champs[$champ_position]['nom_champ_table'];
if ( ! $bdd->requete($sql) )
{
info($langue['er_titre'], sprintf($langue['er_delete'], 'champs[' . $champ_position . '] de la table des membres'), __LINE__, __FILE__, $sql);
}
$tmp_champs = array();
for ( $i = 0; $i < $compte_champs; $i++ )
{
if ( $champs[$i]['champ_id'] == $id )
{
$tmp_champs[] = $champs[$i];
}
}
$compte_champs = count($tmp_champs);
$cache->write_in_cache($tmp_champs, 'champs', $compte_champs);
return TRUE;
}
class_cache.php, on ajoute ça :
/****************************
* Mod Nouveau champ
* Génère le code à écrire dans le fichier fichier_nv_champs.php
****************************/
function write_from_champs($data, $count_data)
{
$this->code_to_write = '$champs = array(' . "\n";
$this->code_to_write .= $this->assign_fields($data, $count_data, array(
'champ_id',
'actif',
'nom_champ',
'nom_champ_table',
'type',
'radio1',
'radio2',
'radio3',
'radio5',
'radio6'
));
$this->code_to_write .= ");\n\n" . '$compte_champs = count($champs);';
return ($this->code_to_write);
}
Voilà , j'aimerai savoir si ce code est bon, car étant vraiment mauvais pour toute la classe cache, enfin je commence un peu à comprendre, mais je ne suis pas sà»r que ce code soit bon...
Donc les pros svp
