Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

il y a 9 mois
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. include('inc/core.php');
  3. if(isLogged()){
  4. header('Location: index.php');
  5. die('<a href="login.php">Cliquez ici si vous n\'êtes pas redirigé automatiquement');
  6. }
  7. if (isset($_POST['inputEmail']) && isset($_POST['inputPassword']) && isset($_POST['inputLastname']) && isset($_POST['inputFirstname'])) {
  8. $login = filter_input(INPUT_POST, 'inputEmail');
  9. $password = hash('sha256', filter_input(INPUT_POST, 'inputPassword'));
  10. $Pdostatinscripton = $mysql->prepare('INSERT INTO users VALUES (NULL, :mail, :motdepasse, :nom, :prenom)');
  11. $Pdostatinscripton->bindValue(':mail',$login, PDO::PARAM_STR);
  12. $Pdostatinscripton->bindValue(':motdepasse', $password, PDO::PARAM_STR);
  13. $Pdostatinscripton->bindValue(':nom',filter_input(INPUT_POST, 'inputLastname'), PDO::PARAM_STR);
  14. $Pdostatinscripton->bindValue(':prenom',filter_input(INPUT_POST, 'inputFirstname'), PDO::PARAM_STR);
  15. $insertIsOk = $Pdostatinscripton->execute();
  16. if ($insertIsOk) // Inscription Ok !
  17. {
  18. $_SESSION['login'] = $login;
  19. $_SESSION['id'] = $mysql->lastInsertId();
  20. $_SESSION['password'] = $password;
  21. $message = $_SESSION['message'] = 'Vous êtes désormais inscrit !';
  22. $message_type = $_SESSION['message_type'] = 'success';
  23. $message_redirect = true;
  24. header('Location: index.php');
  25. } else // Acces pas OK !
  26. {
  27. $message = 'Une erreur s\'est produite lors de votre inscription. Réessayez plus tard.';
  28. $message_type = "danger";
  29. }
  30. $query->CloseCursor();
  31. }
  32. ?>
  33. <!doctype html>
  34. <html lang="fr">
  35. <head>
  36. <meta charset="utf-8">
  37. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  38. <meta name="description" content="">
  39. <meta name="author" content="">
  40. <link rel="icon" href="img/favicon.ico">
  41. <title>Le coin des g@mers - Identification</title>
  42. <link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/sign-in/">
  43. <!-- Bootstrap core CSS -->
  44. <link href="css/bootstrap.min.css" rel="stylesheet">
  45. <!-- Custom styles for this template -->
  46. <link href="css/login.css" rel="stylesheet">
  47. </head>
  48. <body class="text-center">
  49. <form class="form-signin" method="post">
  50. <img class="mb-4" src="https://getbootstrap.com/docs/4.0/assets/brand/bootstrap-solid.svg" alt="" width="72"
  51. height="72">
  52. <h1 class="h3 mb-3 font-weight-normal">Identification</h1>
  53. <?php if (isset($message) or isset($_SESSION['message'])) { ?>
  54. <div class="alert alert-<?php if (isset($message)) { echo $message_type; } else {echo $_SESSION['message_type'];} ?>" role="alert">
  55. <?php
  56. if (isset($message)) {
  57. echo $message;
  58. } else {
  59. echo $_SESSION['message'];
  60. if($message_redirect = true){ echo ' <a href="index.php">Il semble que vous n\'avez pas été redirigé. Cliquez ici pour retourner à l\'accueil.</a>'; }
  61. unset($_SESSION['message']);
  62. unset($_SESSION['message_type']);
  63. }
  64. ?>
  65. </div>
  66. <?php } ?>
  67. <label for="inputEmail" class="sr-only">Email</label>
  68. <input type="email" id="inputEmail" name="inputEmail" class="form-control" placeholder="Email" required autofocus>
  69. <label for="inputLastname" class="sr-only">Nom</label>
  70. <input type="text" id="inputLastname" name="inputLastname" class="form-control" placeholder="Nom" required autofocus>
  71. <label for="inputFirstname" class="sr-only">Prénom</label>
  72. <input type="text" id="inputFirstname" name="inputFirstname" class="form-control" placeholder="Prénom" required autofocus>
  73. <label for="inputPassword" class="sr-only">Mot de passe</label>
  74. <input type="password" id="inputPassword" name="inputPassword" class="form-control" placeholder="Mot de passe"
  75. required>
  76. <button class="btn btn-lg btn-primary btn-block" type="submit">Connexion</button>
  77. <br>
  78. <a class="mt-5 mb-3" href="register.php">S'inscrire</a>
  79. <p class="mt-5 mb-3 text-muted">&copy; 2020</p>
  80. </form>
  81. </body>
  82. </html>