Advertisement
Guest User

Untitled

a guest
May 4th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. include('User.php');
  3. if (isset($_POST['register'])) {
  4. header('Location: inscription.php');
  5. }
  6. session_start();
  7. if (isset($_SESSION['login'])) {
  8. header('Location: mainPage.php');
  9. }
  10. if (!isset($_SESSION['login'])) {
  11. if (isset($_POST['login']) && isset($_POST['password'])) {
  12. $user = User::login_email_pwd($_POST['login'], $_POST['password']);
  13. if ($user) {
  14. $_SESSION['login'] = $_POST['login'];
  15. header('Location: mainPage.php');
  16. } else {
  17. echo('Invalid fields');
  18. }
  19. }
  20. }
  21. ?>
  22.  
  23. <html>
  24. <head>
  25. <title>420 px</title>
  26. </head>
  27. <body>
  28. <?
  29. echo '<form name="login" method="post" action="login.php">';
  30. echo 'Login : <input type = "texte" name="login"> <br />';
  31. echo 'Password : <input type = "password" name="password"> <br />';
  32. echo '<input type = "submit" name="connexion" value = "connexion">';
  33.  
  34. echo '<form name="register" method="post" action="login.php">';
  35. echo '<input type = "submit" name="register" value="inscription">'
  36. ?>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement