Show sourcecode
The following files exists in this folder. Click to view.
admin.php
confirmSignIn.php
createadmin.php
logIn.php
signIn.php
start.php
startsida.php
style.css
tables.php
update.php
start.php
47 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Jass</title>
<link rel="stylesheet" href="style.css" title="General stylesheet">
</head>
<body>
<?php
// Om man tryckt på "logga ut"-knappen, ränsa alla cookies och omdirigera till inloggningssidan.
if (isset($_POST["logOut"])) {
$time = time() - 1;
setcookie("id", "", $time);
setcookie("username", "", $time);
setcookie("password", "", $time);
setcookie("type", "", $time);
header("location: logIn.php");
}
?>
<header>
<?php
$local = false;
if (isset($_COOKIE["playerid"]) && isset($_COOKIE["username"]) && isset($_COOKIE["password"]) && isset($_COOKIE["mail"]) && isset($_COOKIE["type"])) {
// Skriv ut användarens namn i headern
echo "<p>Hej ". $_COOKIE["username"] . "!</p>";
// Lägg till en länk till admin-sidan om användaren är en admin
if ($_COOKIE["type"] == "admin") {
echo "<a href='admin.php'>Admin</a>";
}
} else {
// Omdirigera till inloggningssidan om användaren inte är inloggad(inga cookies finns)
header("location: logIn.php");
}
include ('../dbconnection.php');
?>
<!-- Knapp för att logga ut -->
<form method="post"><input type="submit" name="logOut" value="Logga ut"></form>
</header>