Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function canLogin($p_username, $p_password){
- //todo: database implementeren
- if($p_username=="hello@moyadesign.be" && $p_password="123"){
- return true;
- } else {
- return false;
- }
- }
- //wordt er ingelogd?
- if (!empty($_POST)) {
- // opvragen wat binnen komt
- $username = $_POST ['email'];
- $password = $_POST ['password'];
- // controleren of login mag?
- //if ok: naar loggedin.php
- if (canLogin($username, $password)){
- header('Location: loggedin.php');
- } else { //else feedback tonen
- $error = "Oh boy, that didn't go well.";
- }
- }
- ?><!DOCTYPE html>
- <html lang="en">
- <head>
- <link rel="stylesheet" href="css/style.css" />
- <meta charset="UTF-8">
- <title>Login</title>
- </head>
- <body>
- <div class="box">
- <h1>Login</h1>
- <form action="" method="post">
- <?php if( isset($error)): ?>
- <div class="feedback">
- Oh boy, that didn't go well.
- </div>
- <?php endif; ?>
- <div class="form-group">
- <label for="email">Email address</label>
- <input name="email" id="email" type="email" />
- </div>
- <div class="form-group">
- <label for="password">Password</label>
- <input name="password" id="password" type="password" />
- </div>
- <div class="form-group">
- <button type="submit">Login</button>
- </div>
- </form>
- </div>
- <hr />
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement