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
| <div id="conteneur">
<?php
/*transfert de la variable de session nom dans une variable */
$nom = $_SESSION['nom'];
/*recupere la valeur du champ par la variable GET*/
$affiche=($_GET['nom']);
/* efface l'image grace au chemin qui a été stoqué dans la variable*/
unlink($affiche);
/*réecriture du fichier texte sans le chemin de l'image éffacé*/
$array = file("../galerie/photos_$nom.txt");
$newfile = "";
foreach($array as $line) {
if ($line != $affiche)
$newfile .= $line."\n";
}
$file = fopen("../galerie/photos_$nom.txt","w+");
fwrite($file,$newfile);
fclose($file);
echo "La suppréssion de l'image a bien été effectué";
echo '<SCRIPT LANGUAGE="JavaScript">
function redirect() {
window.location="sup_image_galerie.php"
}
setTimeout("redirect()",3000); </SCRIPT>';
?>
</div> |
Partager