1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function compteMot($chaine_a_tester,$mot) {
$mot = strtolower($mot);
$chaine_a_tester = strtolower($chaine_a_tester);
$t = explode(" ",$chaine_a_tester);
$compteur = 0;
for($i=0;$i<count($t);$i++) {
if ($t[i]==$mot) $compteur++;
}
return $compteur;
}
function testServeur($chemin_pslist,$nom_process) {
$chemin_pslist.=" ".$nom_process;
$retour_pslist = system($chemin_pslist);
if ($retour_pslist==FALSE) return FALSE;
$compteur = 0; //compte le nombre de process du meme nom
$test = stristr($retour_pslist,"was not found");
if ($test!=FALSE) return "stop";
$compteur = compteMot($retour_pslist,$nom_process);
return $compteur;
} |
Partager