–classe JS–
–session storage–



On top of the previous ones, on this site JS 



Part 1 – Management of the users

  • Add a user table to the database, with email, password and registration date.
  • Add at least 3 users.
  • Check the user exists in the database by modifiying verification.php.  The following code may inspire you.
$sql = "SELECT count(*) as total FROM utilisateur WHERE login=:login AND mdp=:mdp";
$resultats = $dbh->prepare($sql);
$login = "login";
$mdp = "mdp";
$resultats->bindParam(":login", $login);
$resultats->bindParam(":mdp", $mdp);
$row= $resultats->fetch(PDO::FETCH_ASSOC);

echo var_dump($row);
echo $row["total"];
  • Only allow connected users to use the application


Part 2 – Discover JavaScript

  • Create a file function.js which displays ‘hello’ on the screen and the console. Include this file in index.php. To see the resultat, right click ->examine element->console


  • Create a page inscription.php which allows to add a user using today’s date.
  • Add the cdn of Jquery on the registration page


  • Allo to display the login in Javascript when validating the form
<!DOCTYPE html>
<script src=""></script>

<input type="text" id="nom" value="waza">

 $(document).ready(function(){ var nom= $( "#nom" ).val(); alert(nom); });
  • Propose to register or to connect on the page index.html


Part 3 – Classes and session

  • Define a user class in JavaScript in user.js
  • During the registration, save the new user as an objet and display in console
  • Save it in sessionStorage 
class Fruit{
  constructor(couleur, grammes) {
    this.couleur= couleur;
     this.grammes= grammes;
  get kilo(){
    return this.grammes/1000;
let monFruit = new Fruit();