From 949737cf5fc2a21b36c4a269a437d0dc2e965441 Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 9 Feb 2024 15:56:55 +0100 Subject: 1er commit --- photospolo/listephoto.php | 110 +++++++++++++++++++++++++++++++++++++++++++++ photospolo/photo.txt | 1 + photospolo/photomodif.php | 53 ++++++++++++++++++++++ photospolo/photoupload.php | 90 +++++++++++++++++++++++++++++++++++++ photospolo/polo.jpg | Bin 0 -> 9064 bytes 5 files changed, 254 insertions(+) create mode 100644 photospolo/listephoto.php create mode 100644 photospolo/photo.txt create mode 100644 photospolo/photomodif.php create mode 100644 photospolo/photoupload.php create mode 100644 photospolo/polo.jpg (limited to 'photospolo') diff --git a/photospolo/listephoto.php b/photospolo/listephoto.php new file mode 100644 index 0000000..a2026db --- /dev/null +++ b/photospolo/listephoto.php @@ -0,0 +1,110 @@ + + + + + + + photos de polo + + + + + + + +
+ +
+

sakuraphotos de polosakura

+
+ +
  • +

    retour page précédente

    +
  • + + + + +
    +

    Choisir une photo parmi celles déjà sur le serveur:

    + +
    + query('SELECT * FROM photospolo'); + while ($données = $réponse->fetch()) + { + echo('
    photo'); + echo('

    ' . $données['nomphoto'] . '

    '); + } + + $réponse->closeCursor(); + ?> +
    + +
    + +
    + +
    +

    Télécharger une nouvelle photo depuis mon PC / tablette / téléphone.

    + + + + +
    + +

    Attention: taille maximale de 2 MO !

    +
    + +
  • +

    Ne pas oublier de cliquer sur "déconnexion" quand on a fini !

    +

    déconnexion

    +
  • + + + diff --git a/photospolo/photo.txt b/photospolo/photo.txt new file mode 100644 index 0000000..23c7e3a --- /dev/null +++ b/photospolo/photo.txt @@ -0,0 +1 @@ +polo.jpg \ No newline at end of file diff --git a/photospolo/photomodif.php b/photospolo/photomodif.php new file mode 100644 index 0000000..9be46c0 --- /dev/null +++ b/photospolo/photomodif.php @@ -0,0 +1,53 @@ +prepare('SELECT * FROM photospolo WHERE id = :numero'); + $requête->execute(array('numero' => $_GET['id'])); + + while ($données = $requête->fetch()) + { + $nom = $données['nomphoto']; + } + + $requête->closeCursor(); + + $fichier = fopen('photo.txt','r+'); + ftruncate($fichier,0); // évite les problèmes quand on change pour un titre plus court + fputs($fichier, $nom); + fseek($fichier, 0); + fclose($fichier); + + header('Location: ../administration.php?modifphoto=4'); + exit (); +} +else +{} + +?> diff --git a/photospolo/photoupload.php b/photospolo/photoupload.php new file mode 100644 index 0000000..c3a2079 --- /dev/null +++ b/photospolo/photoupload.php @@ -0,0 +1,90 @@ +prepare('INSERT INTO photospolo (nomphoto) VALUES (:nom)'); + $requête->execute(array('nom' => $nom)); + + $requête->closeCursor(); + + // changer le nom de la photo sélectionnée dans le fichier photo.txt + $fichier = fopen('photo.txt','r+'); + ftruncate($fichier,0); // évite les problèmes quand on change pour un nom plus court + fputs($fichier, $nom); + fseek($fichier, 0); + fclose($fichier); + + header('Location: ../administration.php?modifphoto=4'); // succès, move_uploaded_file renvoie la valeur TRUE + exit (); + } + else // echec à l'enregistrement, la fonction renvoie FALSE + { + header('Location: ../administration.php?modifphoto=3'); + exit (); + } + } + else // mauvais format + { + header('Location: ../administration.php?modifphoto=2'); + exit (); + } +} +else // mauvaise taille +{ + header('Location: ../administration.php?modifphoto=1'); + exit (); +} + +?> diff --git a/photospolo/polo.jpg b/photospolo/polo.jpg new file mode 100644 index 0000000..6d9ccb6 Binary files /dev/null and b/photospolo/polo.jpg differ -- cgit v1.2.3