Advertisement
Guest User

Untitled

a guest
Sep 15th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <?php
  3. class Utilisateur {
  4. protected $login;
  5. protected $pass;
  6. protected $typeUser; // Administrateur, fournisseur ou client
  7.  
  8. function __construct($login, $pass, $typeUser) {
  9. echo "<p>Utilisateur créé</p>";
  10. $this->login = $login;
  11. $this->pass = $pass;
  12. $this->typeUser = $typeUser;
  13. }
  14.  
  15. public function isAuthentified($login, $pass) {
  16. if ($login == $this->login && $pass == $this->pass) {
  17. echo "Utilisateur " . $login . " connecté !";
  18. return true;
  19. }
  20. return false;
  21. }
  22.  
  23. public function securePage($authLevels) {
  24.  
  25. }
  26.  
  27. public function getUser() {
  28.  
  29. }
  30.  
  31. public function logout() {
  32. logout();
  33. }
  34.  
  35. }
  36.  
  37. $u = new Utilisateur(htmlspecialchars($_POST["login"]), htmlspecialchars($_POST["pass"]), htmlspecialchars($_POST["typeUser"]));
  38. $u->isAuthentified("toto","z");
  39. ?>
  40.  
  41. <html>
  42. <head>
  43. <title>TDm2</title>
  44. </head>
  45. <body>
  46. <form action="TDm2.php" method="post">
  47. Login : <input type="text" name="login" id="login"><br />
  48. Mot de passe : <input type="password" name="pass" id="pass"><br />
  49. <p>Type d'user : </p><input type="radio" name="typeUser" value="client" checked>Client<br />
  50. <input type="radio" name="typeUser" value="fournisseur">Fournisseur<br />
  51. <input type="radio" name="typeUser" value="admin">Administrateur<br />
  52. <button>Go !</button>
  53. </form>
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement