View sourcecode

The following files exists in this folder. Click to view.

index.php

54 lines ASCII 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
<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Inlogg grund 1a</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
</head>
<body>
    <div class="container-fluid pt-5">
        <div class="row justify-content-center">
            <?php
                
if(isset($_GET['mess']))
                    switch(
$_GET['mess']){
                        case 
'wrong':
                            echo
"<div class=\"alert alert-danger col-md-4\" role=\"alert\">
                                    Wrong username or password!
                                </div>"
;
                            break;
                        case 
'error':
                            echo
"<div class=\"alert alert-danger col-md-4\" role=\"alert\">
                                    An unexpected error occured.
                                </div>"
;
                            break;
                        case 
'logout':
                            echo
"<div class=\"alert alert-success col-md-4\" role=\"alert\">
                                    You have been successfully logged out.
                                </div>"
;
                            break;
                    }
            
?>
        </div>
        <div class="row justify-content-center">
            <form class="col-md-4" action="login.php" method="POST">
                <div class="mb-3">
                    <label for="exampleInputEmail1" class="form-label">Username</label>
                    <input type="text" class="form-control" id="exampleInputEmail1" name="username" required>
                    <div class="invalid-feedback">
                        Please write your username.
                    </div>
                </div>
                <div class="mb-3">
                    <label for="exampleInputPassword1" class="form-label">Password</label>
                    <input type="password" class="form-control" id="exampleInputPassword1" name="password" required>
                    <div class="invalid-feedback">
                        Please write your password username.
                    </div>
                </div>
                <button type="submit" class="btn btn-primary">Login</button>
            </form>
        </div>
    </div>
</body>
</html>