".$msg['procs_title_form_import']."
";
$erreur=0;
$userfile_name = $_FILES['f_fichier']['name'];
$userfile_temp = $_FILES['f_fichier']['tmp_name'];
$userfile_moved = basename($userfile_temp);
$userfile_name = preg_replace("/ |'|\\|\"|\//m", "_", $userfile_name);
// création
if (move_uploaded_file($userfile_temp,'./temp/'.$userfile_moved)) {
$fic=1;
}
if (!$fic) {
$erreur=$erreur+10;
}
if ($fic) {
$fp = fopen('./temp/'.$userfile_moved , "r" );
$contenu = fread ($fp, filesize('./temp/'.$userfile_moved));
if (!$fp || $contenu=="") $erreur=$erreur+100; ;
fclose ($fp) ;
}
if ($userfile_name) {
unlink('./temp/'.$userfile_moved);
}
$pos = strpos($contenu,'INSERT INTO '.$table[$type_proc].' set ');
if (($pos === false) || ($pos>0)) {
$erreur=$erreur+1000; ;
}
if (!$erreur) {
// ajouter les droits pour celui qui importe
if ($PMBuserid!=1) $contenu = str_replace("autorisations='1'", "autorisations='1 ".$PMBuserid."'", $contenu) ;
mysql_query($contenu, $dbh) ;
if (mysql_error()) {
echo mysql_error()."
".htmlentities($contenu,ENT_QUOTES, $charset)."
" ;
die ();
}
$new_proc_id = mysql_insert_id();
$retour = str_replace("!!id!!",$new_proc_id,$retour);
print "";
print "";
} else {
print "".$msg['procs_import_invalide']."
";
}
print "";
}
?>