Créé en 2020 et modifié le 11 Feb 2022

Créé en 2020 et modifié le 11 Feb 2022

PHP and File

–php–
–client serveur–
–formulaire recup php–
–lecture ecriture php–
–json–

Ressources

On top of the former ones, the reference site for PHP and on this site the synthesis of  PHP

Users management

Part 1

Delivrable : zootickoon/mission3/…

<?php echo "Hello"; ?>
  • Transform index.html into index.php
  • At the beginning of the page index.php display the picture of a zebra in the morning, of a girafe in the afternoon a,d of a panda at noon.
$heure = date("H");

 

Part 2

Delivrable : zootickoon/mission3/…

  • Create a connexion form with email, password, and approval in authentification.html adding Bootstrap classes. You will have to respect the corresponding input type. Autofocus in the email box.
  • Recover the informations of authentification.html, then display them on the verification.php page using the GET method.
  • Use the POST method but change the form method. What is the difference in the URL, for both methods ?
  • On verification.php, add a table
$utilisateurs =["[email protected]","passeLina","[email protected]","passeEdgar"];
  • Check that the couple {email, password} entered in authentification exists in $utilisateurs.
  • Save the email in session variable and display “connecté”+email if it works.
  • Display an error message and a red frame using bootstrap in case of error on verification.php
  • Bonus :  Change authentification.html by authentification.php. Redirect on authentification.php in case of error use bootstrap to valid the form
    https://getbootstrap.com/docs/5.0/forms/validation/

 

Part 3

Delivrable : zootickoon/mission3/…

  • Save all the authentification.html values entered by the users in a long.log file. Also save the date and time using a timestamp.
  • Save the valid couples emails/password in a  login.json file.
{
  logs:
   [{"email":"a","mdp":"a"},
    {"email":"b","mdp":"b"},
    {"email":"c","mdp":"c"}]
}
$auth = new class {};
$auth->log=[['a' => "b", 'c' => "d"],['e' => "f", 'g' => "h"]];

 

  • Modify verification.php to test the values of the json file.