Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once ('functions.inc.php');
- if ( !empty($_POST)) {
- //get username and password from $_POST
- $username = $_POST['email'];
- $password = $_POST['password'];
- // check if a user can login (function)
- if (canILogin($username, $password) == true) {
- //remember login (cookie)
- session_start();
- $_SESSION['username'] = $username;
- $_SESSION['loggedin'] = true;
- /* $salt = "21313abrea34567";
- $cookieVal = $username . "," . md5($username.$salt);
- setcookie("login", "$cookieVal", time()+60*60*24*7); //<- 1 week!*/
- //if yes redirect to index.php
- header('Location: index.php');
- }
- else {
- //if no -> $error tonen
- $error = true;
- }
- // remember login (cookie)
- // if yes -> redirect to index.php
- // if no -> $error tonen
- }
- ?><!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>IMDFlix</title>
- <link rel="stylesheet" href="css/style.css">
- </head>
- <body>
- <div class="netflixLogin">
- <div class="form form--login">
- <form action="" method="post">
- <h2 form__title>Sign In</h2>
- <?php if(isset($error)):?>
- <div class="form__error">
- <p>
- Sorry, we can't log you in with that email address and password. Can you try again?
- </p>
- </div>
- <?php endif; ?>
- <div class="form__field">
- <label for="email"l">Email</label>
- <input type="text" id="email" name="email">
- </div>
- <div class="form__field">
- <label for="Password">Password</label>
- <input type="password" id="password" name="password">
- </div>
- <div class="form__field">
- <input type="submit" value="Sign in" class="btn btn--primary">
- <!--type moet submit zijn om te verzenden-->
- <input type="checkbox" id="rememberMe"><label for="rememberMe" class="label__inline">Remember me</label>
- </div>
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement