"; } $func = new functions(); $time = $func->get_session_time_expire(); if( isset($_SESSION['last_emet_search']) && !isset($_SESSION['emet_id'])) { //Insertion rapide if( preg_match("/(.*),(.*)/",$_SESSION['last_emet_search'],$matches1) > 0 && count($matches1 == 3) ) { $lastname = $matches1[1]; if( preg_match("/(.*)\[(.*)\]/",$matches1[2],$matches2) > 0 && count($matches2 == 3) ) { $firstname = $matches2[1]; $society = $matches2[2]; } else { $firstname = $matches1[2]; } } else { if( preg_match("/(.*?)\[(.*)\]/",$_SESSION['last_emet_search'],$matches2) > 0 && count($matches2 == 3) ) { $lastname = $matches2[1]; $society = $matches2[2]; } else { $lastname = $_SESSION['last_emet_search']; } } } if( isset($_POST['submit']) ) { //Store in $_SESSION['new_emet'] $db->connect(); $db->query("SHOW COLUMNS FROM ".$_SESSION['tablename']['senders']); unset($_SESSION['new_emet']); unset($_SESSION['emet_id']); //Hack : Pour les civilité morales, on duplique le champ societé dans Nom if ($_POST['society_tag'] == "society"){ $_POST['LASTNAME'] = $_POST['SOCIETY']; $_POST['FIRSTNAME'] = ''; } //Verification que les champs obligatoire sont saisis if ($_POST['LASTNAME']=='' && !$_POST['society_tag']){ $_SESSION['error'] .= _NAME." "._IS_EMPTY; } if ($_POST['SOCIETY'] == '' && $_POST['society_tag'] == "society"){ $_SESSION['error'] .= _SOCIETY." "._IS_EMPTY; } if ($_SESSION['error'] == ''){ while($field = $db->fetch_object()) { if( isset($_POST[$field->Field]) ) $_SESSION['new_emet'][$field->Field] = $_POST[$field->Field]; } $db->deco(); if ($_SESSION['new_emet_tmp']['value'] == "true"){ //on supprime les valeurs temporaires afin de reunifer la gestion des emetteurs unset($_SESSION['new_emet_tmp']); } ?>