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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
<?php
// Fichier souhaité
$Cible = "data.txt";
// Ouverture du fichier
$data = @fopen($Cible, "r");
// debut de la boucle en if pour connaitre le nombre de round contenu dans data
if( preg_match('#(Round){6}#', "$data"))
{
$variable = preg_replace('#(.Round 2)(^Round 6).#', 'img1 $1 img2 $2',"$data");
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 6 Round<br> ' . $variable . '';
}
else
{
if( preg_match('#(Round){5}#', "$data"))
{
$variable = preg_replace('#(.Round 2)(^Round 5).#', 'img1 $1 img2 $2',"$data");
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 5 Round<br> ' . $variable . '';
}
else
{
if( preg_match('#(Round){4}#', $data))
{
$variable = preg_replace('#(.Round 2)(^Round 4).#', 'img1 $1 img2 $2',$data);
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 4 Round<br> ' . $variable . '';
}
else
{
if( preg_match('#(Round){3}#', "$data"))
{
$variable = preg_replace('#(.Round 2)(^Round 3).#', 'img1 $1 img2 $2','$data');
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 3 Round<br> ' . $variable . '';
}
else
{
if( preg_match('#(Round){2}#', "$data"))
{
$variable = preg_replace('#(.Round 2)(^Round 2).#', 'img1 $1 img2 $2','$data');
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 2 Round<br> ' . $variable . '';
}
else
{
if( preg_match('#(Round){1}#', "$data"))
{
$variable = preg_replace('#.#', 'img1 $1 img2','$data');
// ecrire les lignes copier dans un fichier dest.txt
file_put_contents( 'dest.txt', $variable);
// Fermeture du fichier
@fclose($data);
echo 'Le RC contient 1 Round<br> ' . $variable . '';
}
else
{
echo 'erreur lors de la copie du RC';
}
}
}
}
}
} |
Partager