Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4. <?php
  5. session_start();
  6.  
  7. //instellen gebruikersnaam en wachtwoord
  8. $usernamecheck = 'admin';
  9. $passwordcheck = 'admin';
  10.  
  11. //controle of er op submit is geklikt
  12. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  13.  
  14. //controle of alles is ingevuld
  15. if(isset($_POST['user']) && isset($_POST['pass'])) {
  16.  
  17. //spaties verwijderen en omzetten naar html
  18. $user = trim($_POST['user']);
  19. $pass = trim($_POST['pass']);
  20. $user = htmlspecialchars($_POST['user']);
  21. $pass = htmlspecialchars($_POST['pass']);
  22.  
  23. //gebruikersnaam en wachtwoord controleren
  24. if($user == $usernamecheck && $pass == $passwordcheck) {
  25.  
  26. //als het de juiste gegevens zijn dan inloggen
  27. $_SESSION['logged_in'] = true;
  28. $_SESSION['gebruiker'] = $user;
  29.  
  30. //doorsturen naar volgende pagina
  31. header('Location: ingelogd.php');
  32. exit;
  33. }
  34.  
  35. else {
  36. //terugsturen en foutmelding geven
  37. echo 'De combinatie van gebruikersnaam en wachtwoord is onjuist';
  38. ?>
  39. <form action = 'login_form.php'><p><input type = 'submit' value = 'Terug naar de inlogpagina' /></p></form>
  40. <?php
  41. }
  42. }
  43.  
  44. else {
  45. echo 'Niet alles is ingevuld';
  46. ?>
  47. <form action = 'login_form.php'><p><input type = 'submit' value = 'Terug naar de inlogpagina' /></p></form>
  48. <?php
  49. }
  50. }
  51. else {
  52. //terug naar de inlogpagina
  53. header('Location: login_form.php');
  54. exit();
  55. }
  56. ?>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement