1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| function get_scenario($file){
$open = fopen($file, "r") or die("<strong>problème d'ouverture fichier</strong>");
if ($open) {
$cmpt=0;
$id="";
while (!feof($open)) {
$cmpt++;
$id=$id.fgets($open, 4096);
}
$id=rtrim($id);
$ID = str_replace("\n"," ",$id);
$IDS = str_replace("\n","_",$id);
if ( ($cmpt<2) && (!empty($id)) ) {//ne respecte pas la condition
$requete_python = ('python createNewickTags.py '.$ID.'');
print (" test ");print($requete_python) or die;
exec($requete_python);
$create_page = (' perl ../bin/tree_viewer/view-tree.pl query='.$ID.' db=HOVERGEN type=species > ../tmp/scenario.html');
exec($create_page);
}
elseif ( ((($cmpt>2) && ($cmpt<=4))) && (!empty($id)) ){
$requete_python2 = ('python createNewickTags.py "'.$ID.'"');
exec($requete_python2);
$create_page2 = (' perl ../bin/tree_viewer/view-tree.pl query='.$IDS.' db=HOVERGEN type=species > ../tmp/scenario.html');
exec($create_page2);
}
elseif ($cmpt>4){
$_SESSION['ERROR'] = ('Cette requete ne prend que 3 IDs en argument<br> veuillez resaisir une requete');
header("location:../pages/acceuil2.php") or die("Ne retourne pas à la page d'acceuil");
}
}
fclose($open);
header("location:../tmp/scenario.html");
} |