moment04/
wesweb01/moment04/login.php1 lines
<?php
# Glöm inte att kommentera skiten också...
include("functions.php");
check_user_logged_in(true);
$isLoginInvalid = false;
if (isset($_POST["username"]) && isset($_POST["password"])) {
$result = check_login($_POST["username"], $_POST["password"]);
if ($result) {
$_SESSION = $result;
header("location: index.php");
exit();
} else
$isLoginInvalid = true;
}
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>m04 - Inlogg</title>
<link rel="stylesheet" type="text/css" href="../css/materialize.css">
<script defer type="text/javascript" src="../js/materialize.js"></script>
</head>
<body>
<div class="row">
<div class="col s4 offset-s4">
<h1>Logga in</h1>
<form method="POST">
<?php
if ($isLoginInvalid)
echo "<p>Fel användarnamn eller lösenord.</p>";
?>
<p>
<label for="username">Användarnamn: </label>
<input id="username" type="text" name="username" class="validate" required>
</p>
<p>
<label for="password">Lösenord: </label>
<input id="password" type="password" name="password" class="validate" required>
</p>
<p>
<input class="btn red accent-2" type="submit" value="Logga in">
</p>
</form>
<h4>Saknar konto?</h4>
<a class="btn red accent-2" href="signup.php">Skapa konto</a>
</div>
</div>
</body>
</html>