<html> <head> <title>source postdictio.php</title> </head> <body> <? function otecontrole($phr) { $lon=strlen($phr); $prov=""; for($i=0;$i<$lon;$i++) { $l1=substr($phr,$i,1); if(ord($l1)>31) $prov=$prov.$l1; } return $prov; }; function fon($int) { $mot=otecontrole($int); $fic='langue.txt'; $choix=substr($mot,0,1); if(strcmp($choix,'+')==0) { $nomfichier = fopen($fic, "a") ; if ( !($nomfichier)) { print(" Impossible d’ouvrir le fichier $fic en écriture"); exit ; } $f=substr($mot,1,strlen($mot)-1); $f=$f."\n"; $f=stripslashes($f); fputs($nomfichier, $f); fclose($nomfichier) ; // on ferme le fichier, on libère les ressources print("la ligne $f a été ajoutée à la fin du fichier $fic<br>"); return $f; } if(strcmp($choix,'&')==0) { echo 'langueaide.txt'; $fic='langueaide.txt'; $int=substr($mot,1,strlen($mot)-1); $mot=$int; } $nomfichier = fopen($fic, "r") ; if ( !($nomfichier)) { print(" Impossible d’ouvrir le fichier $fic en lecture") ; exit ; } $l1=substr($int,0,1); if(strcmp($l1,'_')==0) { $mot=$int; } elseif(strstr($mot,"_")==false) { $int=$mot.'_'; $mot=$int; } $int=$mot; $trad=$int; $f=$int; while ( !feof($nomfichier) ) { $ligne = fgets($nomfichier,255); // 255 caractères max. ou bien fin de ligne. if(strcmp($choix,"!")==0) { $mot=strstr($ligne,"_"); if(strcmp($mot,'false') != 0) { $trad=substr($ligne,0,strlen($ligne)-strlen($mot)); print $trad."<br>"; } } elseif(strcmp($choix,"?")==0) { $mot=strstr($ligne,"_"); if(strcmp($mot,'false') != 0) { print $mot."<br>"; } } elseif(strlen($ligne)>0) { $mot=$ligne; $trad=stristr($mot,$int); if($trad != false) { if(strcmp($l1,'_')==0) { echo 'Lecture inverse'; $f=substr($ligne,0,strlen($ligne)-strlen($trad)); } else { $f=substr($trad,strlen($int),strlen($trad)-strlen($int)); } $modif=stripslashes($f); print 'Mot '.$int.' Traduction '.$modif.'<br>'; break; } } } fclose ($nomfichier); $f=stripslashes($f); $l1=substr($f,strlen($f)-1,1); if(strcmp($l1,"_")==0) $f=substr($f,0,strlen($f)-1); if(strcmp($choix,'&') != 0) { executer($fon); } return $f; }; function executer($fon) { $nomfichier = fopen("langue.bat","w") ; if ( !($nomfichier)) { print("Impossible de créer le fichier \n") ; exit ; } $l1=substr($f,strlen($f)-1,1); if(strcmp($l1,"_")==0) { $mot=substr($f,0,strlen($f)-1); $f=$mot; } $l1=substr($f,0,2); $modif=stripslashes($f); $f=$modif; if(strcmp($l1,'\"')==0) { fputs($nomfichier, 'c:\\sv3\\mathvox\\mathweb0 '.$f); } else { fputs($nomfichier, 'c:\\sv3\\mathvox\\mathweb0 "'.$f.'"'); } fclose($nomfichier) ; // on ferme le fichier, on libère les ressources }; function fontotal($int) { $prov=otecontrole($int); $int=substr($prov,1,strlen($prov)-1); $int=$int.' '; $prov=''; $f=''; for($i=0;$i<strlen($int);$i++) { $l1=substr($int,$i,1); if(strcmp($l1," ")==0) { if(strcmp($prov,'') != 0) $f=$f.' '.fon($prov); $prov=''; } else $prov=$prov.$l1; } echo "Traduction totale<br>"; return $f; }; ?> <br> <? $int=$_POST['fon']; $l1=substr($int,0,1); if(strcmp($l1,"£")==0) $f=fontotal($int); elseif(strcmp($l1,"$")==0) { $f=stripslashes(substr($int,1,strlen($int)-1)); executer($f); } else $f=fon($int); echo 'Le résultat courant est '.$f; ?> <br> <form> <input type=BUTTON value="Page précédente" onclick="window.history.back()"> </form> <br> <a href="langue.bat">Exécution du résultat courant</a> <br> <a href="aidelangue.bat">Aide de la commande vocale mathweb.exe, pour la lecture en mode caractère, en mode formule...</a> <br> <a href="langue_sommaire.php">Retour dans le sommaire des cours de langues</a> </body> </html>