Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <?php
- session_start();
- //instellen gebruikersnaam en wachtwoord
- $usernamecheck = 'admin';
- $passwordcheck = 'admin';
- //controle of er op submit is geklikt
- if($_SERVER['REQUEST_METHOD'] == 'POST') {
- //controle of alles is ingevuld
- if(isset($_POST['user']) && isset($_POST['pass'])) {
- //spaties verwijderen en omzetten naar html
- $user = trim($_POST['user']);
- $pass = trim($_POST['pass']);
- $user = htmlspecialchars($_POST['user']);
- $pass = htmlspecialchars($_POST['pass']);
- //gebruikersnaam en wachtwoord controleren
- if($user == $usernamecheck && $pass == $passwordcheck) {
- //als het de juiste gegevens zijn dan inloggen
- $_SESSION['logged_in'] = true;
- $_SESSION['gebruiker'] = $user;
- //doorsturen naar volgende pagina
- header('Location: ingelogd.php');
- exit;
- }
- elseif {
- //terugsturen en foutmelding geven
- echo 'De combinatie van gebruikersnaam en wachtwoord is onjuist';
- ?>
- <form action = 'login_form.php'><p><input type = 'submit' value = 'Terug naar de inlogpagina' /></p></form>
- <?php
- }
- }
- elseif {
- echo 'Niet alles is ingevuld';
- ?>
- <form action = 'login_form.php'><p><input type = 'submit' value = 'Terug naar de inlogpagina' /></p></form>
- <?php
- }
- }
- else {
- //terug naar de inlogpagina
- header('Location: login_form.php');
- exit();
- }
- ?>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement