//deconnexion MySQL
    }
}
if ($erreur) {
    header('Location: ../index.php?page=ajouter_lapin&mess=' . urlencode($probleme));
    exit(0);
}
//OK : insertion
$sql = "SELECT id_profil FROM lapin_proprietaire WHERE identifiant = '" . $user . "';";
$resultat = mysql_query($sql);
$idProprietaire = mysql_fetch_array($resultat);
$sql = "INSERT INTO lapin_lapin (nomlap, agelap, race, sexe, couleur, description, centreInteret, identifiant, id_profil) " . "VALUES ('" . $nom . "','" . $age . "','" . $race . "','" . $sexe . "','" . $couleur . "','" . $description . "','" . $interets . "','" . $user . "', " . $idProprietaire['id_profil'] . ");";
if (!mysql_query($sql)) {
    $message = " \nun probleme s'est produit.";
    header('Location: ../index.php?page=ajouter_lapin&mess=' . urlencode($message));
    exit(0);
}
//photo
//GESTION DE LA PHOTO
require_once "upload_photo.inc.php";
if (isset($_FILES['photo'])) {
    $fich = enregistrer_photo($_FILES['photo'], $user);
    if ($fich) {
        //succes upload
        $sql = "UPDATE lapin_lapin SET photo = '" . $fich . "' WHERE identifiant = '" . $user . "' AND nomlap = '" . $nom . "';";
        mysql_query($sql);
    }
}
//fin
header('Location: ../index.php?page=profil');
exit(0);
         header('Location: ../index.php?page=inscription&mess=' . urlencode($message) . '&user='******'&nom=' . urlencode($nom) . '&prenom=' . urlencode($prenom));
         exit(0);
     }
 }
 //insertion
 $sql = "INSERT INTO lapin_proprietaire (identifiant, nom, prenom, code_postal, region, mail, passwd) " . "VALUES ('" . $user . "','" . $nom . "','" . $prenom . "','" . $codepostal . "','" . $region . "','" . $email . "','" . $password . "');";
 if (!mysql_query($sql)) {
     $message = " \nun probleme s'est produit.";
     //renvoi tout sauf mots de passe, mail, code postal (parametres en GET )
     header('Location: ../index.php?page=inscription&mess=' . urlencode($message) . '&user='******'&nom=' . urlencode($nom) . '&prenom=' . urlencode($prenom));
 } else {
     //c'est bon
     //GESTION DE LA PHOTO
     require_once "upload_photo.inc.php";
     if (isset($_FILES['trombine'])) {
         $fich = enregistrer_photo($_FILES['trombine'], $user);
         if ($fich) {
             //succes upload
             $sql = "UPDATE lapin_proprietaire SET trombine = '" . $fich . "' WHERE identifiant = '" . $user . "';";
             mysql_query($sql);
         }
     }
     //ne pas oublier l'identifiant du profil pour la messagerie et la recherche
     $sql = "SELECT id_profil FROM lapin_proprietaire WHERE identifiant = '" . $user . "'";
     $mid = requete_champ_unique($sql);
     //if( ! isset($_SESSION['identifiant']) ){  // modif dom : dans tous les cas réinitialiser l'identifiant
     $_SESSION['identifiant'] = $user;
     //
     $_SESSION['mid'] = $mid;
     //
     session_regenerate_id(true);