$id_sql = $db->insert_id; // Generation d'une alerte back-office $alerte = new Alerte($_SESSION['id_utilisateur'], $table, $id_sql, $donnees_form['titre']); if ($id_formulaire == 11) { $alerte->action = "appropriation"; $alerte->nom_table = secure_table($_GET['nom_table']); } if ($id_formulaire == 11) { $alerte->id_table = secure_id($_GET['id_table']); $alerte->set_niveau(1, 1); $alerte->id_insert = $id_sql; $alerte->table_insert = $table; } else { $alerte->set_niveau(1, 2); } $alerte->enregistre(); $alerte->__destruct(); $sql_droits = 'INSERT INTO droits (id_utilisateurs,nom_table,id_table) VALUES (' . $_SESSION['id_utilisateur'] . ',"' . $table . '",' . $id_sql . ')'; $db->query($sql_droits); if ($db->affected_rows < 0) { echo '<div class="debug debug' . $db->affected_rows . '">DROITS : ' . $sql_droits . ' ' . $db->affected_rows . '</div>'; } else { //update niveau client $sql_droits = 'UPDATE ' . $table . ' SET niveau_client=1 WHERE id=' . $id_sql . ' AND niveau_client<1'; $db->query($sql_droits); if ($db->affected_rows < 0) { echo '<div class="debug debug' . $db->affected_rows . '">NIVEAU CLIENT : ' . $sql_droits . ' ' . $db->affected_rows . '</div>'; } } } //concerne uniquement hebergements et loisirs