- time: documentation ( source)
- sha1: documentation ( source)
- setcookie: documentation ( source)
- header: documentation ( source)
<?php
include "global.php";
?>
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="ie6 ielt8"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="ie7 ielt8"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="login.css" />
</head>
<body>
<div class="container">
<section id="content">
<form method="POST">
<h1><?php echo $SYS_NAAM; ?></h1>
<div>
<input type="text" placeholder="Gebruikersnaam" required="" name="username" />
</div>
<div>
<input type="password" placeholder="Wachtwoord" required="" name="password" />
</div>
<div>
<input type="submit" value="Inloggen!" />
<a href="wachtwoord_vergeten.php">Wachtwoord vergeten?</a>
</div>
</form><!-- form -->
</section><!-- content -->
</div><!-- container -->
</body>
</html>
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$sql = mysqli_query($c, "SELECT username,password FROM personeel,administrators WHERE username='".mysqli_real_escape_string($c, $_POST['username'])."'AND password='".mysqli_real_escape_string($c, sha1($_POST['password']))."'") ;
if ($sql == TRUE) {
setcookie("username", $_POST['username'], time()+1800);
setcookie("loggedin", TRUE, time()+1800);
unset ($_POST);
Header ("Location: landing.php");
} else {
echo mysqli_error($c); //Hier straks: "Gegevens niet gevonden" van maken
} //Sluit COOKIE/REDIRECT/SQL maken af
} //sluit IF METHOD POST
?>