Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <?php session_start(); ?>
- <title> Login </title>
- <link rel="stylesheet" type="text/css" href="style.css">
- <?php include "/menulogin.php" ?>
- </head>
- <body>
- <form method="POST">
- <div class="panel panel-info" style="margin:auto;width:400px;height:400px;">
- <div class="panel-heading">
- <h3 class="panel-title">Login</h3>
- </div>
- <div class="panel-body">
- Gebruikersnaam: <input style="width:300px;" class="form-control" type="text" name="txtUser"/>
- <br/>
- Wachtwoord: <input style="width:300px;" class="form-control" type="password" name="txtPass"/>
- <br/>
- <hr/>
- <button style="float:right" class="btn btn-primary" type="submit" name="btnLogin">Login</button>
- <br/>
- Nog geen account? Registreer <a href="registreren.php">hier</a>
- </div>
- </div>
- <?php
- Require('database.php');
- $db = new Database();
- if(isset($_POST['btnLogin'])){
- $username = $_POST['txtUser'];
- $password = $_POST['txtPass'];
- $result = $db->getLogin($username,$password);
- $rij = mysqli_fetch_object($result);
- if(!empty($rij)){
- $_SESSION['loggedin'] = true;
- $_SESSION['naam'] = $rij->naam;
- $_SESSION['admin'] = $rij->admin;
- header("Location:index.php"); /* Redirect browser */
- exit();
- }else{
- echo "<div class='alert alert-dismissible alert-danger'>
- <button type='button' class='close' data-dismiss='alert'>×</button>
- <strong>Oh oeps!</strong> De inloggevens zijn onjuist.
- </div>" ;
- }
- }
- if (isset($_GET['logout'])) {
- session_destroy();
- }
- ?>
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment