Guest User

Untitled

a guest
Oct 31st, 2016
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <html>
  2. <head>
  3. <?php session_start(); ?>
  4. <title> Login </title>
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. <?php include "/menulogin.php" ?>
  7. </head>
  8. <body>
  9. <form method="POST">
  10. <div class="panel panel-info" style="margin:auto;width:400px;height:400px;">
  11.   <div class="panel-heading">
  12.     <h3 class="panel-title">Login</h3>
  13.   </div>
  14.   <div class="panel-body">
  15. Gebruikersnaam: <input style="width:300px;" class="form-control" type="text" name="txtUser"/>
  16. <br/>
  17. Wachtwoord: <input style="width:300px;" class="form-control"  type="password" name="txtPass"/>
  18. <br/>
  19. <hr/>
  20. <button style="float:right" class="btn btn-primary" type="submit" name="btnLogin">Login</button>
  21. <br/>
  22. Nog geen account? Registreer <a href="registreren.php">hier</a>
  23.   </div>
  24. </div>
  25.  
  26. <?php
  27. Require('database.php');
  28. $db = new Database();
  29. if(isset($_POST['btnLogin'])){
  30.     $username = $_POST['txtUser'];
  31.     $password = $_POST['txtPass'];
  32.     $result = $db->getLogin($username,$password);
  33.     $rij = mysqli_fetch_object($result);
  34.     if(!empty($rij)){
  35.         $_SESSION['loggedin'] = true;
  36.         $_SESSION['naam'] = $rij->naam;
  37.         $_SESSION['admin'] = $rij->admin;
  38. header("Location:index.php"); /* Redirect browser */
  39. exit();
  40.        
  41.     }else{
  42.     echo "<div class='alert alert-dismissible alert-danger'>
  43.  <button type='button' class='close' data-dismiss='alert'>&times;</button>
  44.  <strong>Oh oeps!</strong> De inloggevens zijn onjuist.
  45. </div>" ;
  46.        
  47.        
  48.     }
  49.    
  50.    
  51. }
  52.  
  53. if (isset($_GET['logout'])) {
  54. session_destroy();
  55.    
  56.    
  57. }
  58.  
  59.  
  60.  
  61. ?>
  62. </form>
  63. </body>
  64.  
  65.  
  66.  
  67.  
  68. </html>
Add Comment
Please, Sign In to add comment