Källkodsbrowser

admin.php

78 lines UTF-8 Unix (LF)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
require 'check_login.php';

// Om rollen inte är admin, skicka till användarsidan
if ($_SESSION['role'] !== 'admin') {
    
header("Location: user.php?msg=Du har inte rättigheter");
    exit();
}
?>

<!DOCTYPE html>
<html lang="sv">

<head>
    <meta charset="UTF-8">
    <title>Admin</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
        }

        body {
            background: #f0f2f5;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .container {
            background: #fff;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 500px;
            text-align: center;
        }

        h2 {
            margin-bottom: 20px;
            color: #333;
        }

        p {
            margin-bottom: 30px;
            color: #555;
        }

        a {
            display: inline-block;
            padding: 12px 25px;
            background: #f44336;
            color: white;
            text-decoration: none;
            border-radius: 5px;
            transition: background 0.3s;
        }

        a:hover {
            background: #d32f2f;
        }
    </style>
</head>

<body>
    <div class="container">
        <h2>Välkommen till Admin sida</h2>
        <p>Välkommen <?= htmlspecialchars($_SESSION['username']); ?>!</p>
        <p>Här kan du administrera systemet.</p>
        <a href="logout.php">Logga ut</a>
    </div>
</body>

</html>