Källkodsbrowser

index.php

125 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
session_start
(); // Starta sessionen för att hantera inloggning
$message $_GET['msg'] ?? ''// Eventuellt meddelande från andra sidor (t.ex. felmeddelande)
?>
<!DOCTYPE html>
<html lang="sv">

<head>
    <meta charset="UTF-8">
    <title>Logga in</title>
</head>
<style>
    /* Reset */
    * {
        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;
    }

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

    h2 {
        text-align: center;
        margin-bottom: 30px;
        color: #333;
    }

    label {
        display: block;
        margin-bottom: 5px;
        color: #555;
    }

    input[type="text"],
    input[type="password"] {
        width: 100%;
        padding: 10px;
        margin-bottom: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
    }

    .login {
        width: 100%;
        padding: 12px;
        background: #1b91f8ff;
        border: none;
        color: white;
        font-size: 16px;
        border-radius: 5px;
        cursor: pointer;
        transition: background 0.3s;
    }

    .login[type="submit"]:hover {
        background: #0268dcff;
    }

    .message {
        text-align: center;
        margin-bottom: 15px;
    }

    p {
        margin-top: 35px;
    }

    .btn {
        display: inline-block;
        padding: 12px 20px;
        background: #1b91f8ff;
        color: white;
        text-decoration: none;
        border-radius: 5px;
        font-size: 16px;
        margin-left: 5px;
        transition: background 0.3s;
    }

    .btn:hover {
        background: #166fc0ff;
    }
</style>

<body>
    <div class="login-container">
        <h2>Logga in</h2>
        <?php if ($message)
            echo 
"<p style='color:red;'>$message</p>"?>
        <br>

        <!-- Formulär för att logga in -->
        <form action="login.php" method="post">
            <label>Användarnamn:</label><br>
            <input type="text" name="username"  placeholder="Användarnamn" required><br><br>

            <label>Lösenord:</label><br>
            <input type="password" name="password" placeholder="Lösenord" required><br><br>

            <button type="submit" class="login">Logga in</button>
        </form>

        <p>Har du inget konto? <a href="register.php" class="btn">Registrera dig här</a>
        </p>

    </div>
</body>

</html>