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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
<html>
<body>
<p align="center">
<?PHP
//============lire le repertoire===============================
$data = glob('origine/*.php');
$LesFichiers = array();
$LigneOk = array();
$i = 0;
$combien=0;
$NomDestination="destination/";
foreach( $data as $filename)
{
if (is_file($filename))
{
$Lui = $filename;
$NomDestination=str_replace("origine","destination",$Lui);
/* === on peut renommer par exemple
if (strpos($NomDestination, "divers_outil") !== FALSE )
$NomDestination=str_replace("traver","_X_",$NomDestination);
================= */
/* ============a chaque php le lire================= */
$FichierActu=file($Lui);
$NbrLigne=count($FichierActu)-1;
$LaLigne=0;
/* On lit ligne par ligne */
for($a=0;$a<=$NbrLigne;$a++)
{
$flag=strpos($FichierActu[$a], "DOCTYPE") ;
if ($flag === FALSE ) {$Rien=0;}
else
{
$FichierActu[$a]=str_replace("target=\"_blanck\"","",$FichierActu[$a]);
$combien=$combien+1;
}
$LigneOk[$LaLigne]=$FichierActu[$a];
$LaLigne=$LaLigne+1;
}
/* ============écrire le PHP modifié======= */
$LeFichier=fopen($NomDestination,"w+");
for($a=0;$a<$LaLigne;$a++)
{
$LeTexte=$LigneOk[$a];
fputs($LeFichier,$LeTexte."");
}
fclose($LeFichier);
echo ("fichier ".$NomDestination." traité <br />");
/* ==== Fin de l interrieur d un PHP ==== */
}
}
echo ("Terminé pour ".$combien." fichiers PHP<br />");
?>
<br /></p>
</body>
</html> |
Partager