Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('User.php');
- if (isset($_POST['register'])) {
- header('Location: inscription.php');
- }
- session_start();
- if (isset($_SESSION['login'])) {
- header('Location: mainPage.php');
- }
- if (!isset($_SESSION['login'])) {
- if (isset($_POST['login']) && isset($_POST['password'])) {
- $user = User::login_email_pwd($_POST['login'], $_POST['password']);
- if ($user) {
- $_SESSION['login'] = $_POST['login'];
- header('Location: mainPage.php');
- } else {
- echo('Invalid fields');
- }
- }
- }
- ?>
- <html>
- <head>
- <title>420 px</title>
- </head>
- <body>
- <?
- echo '<form name="login" method="post" action="login.php">';
- echo 'Login : <input type = "texte" name="login"> <br />';
- echo 'Password : <input type = "password" name="password"> <br />';
- echo '<input type = "submit" name="connexion" value = "connexion">';
- echo '<form name="register" method="post" action="login.php">';
- echo '<input type = "submit" name="register" value="inscription">'
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment