aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: b0774c68ef8daceeb24215a07826149e6837d129 (plain)
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
<?php
/*
    praktrack - tracking the parts of a portfolio review
    Copyright (C) 2026  Friedrich Beckmann <friedrich.beckmann@tha.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
*/
include "setup.php";
include "login.php";
my_session_start();

$login = FALSE;
if (!empty($_POST["login"]) and $_POST["login"] === "login") {
    $login = try_login($_POST["username"],$_POST["password"]);
} elseif (isset($_SESSION["login"])) {
    $login = $_SESSION["login"];
}

if ($login === "admin") {
    include "admin-show.php";
} elseif ($login === "user") {
    include "show-user.php";
} else {
?>
<!DOCTYPE html>
<html>
<body>
    <h1>Ergebnisse der Portfolioprüfungen</h1>
    <p>Hier können sie die Teilleistungen der Portfolioprüfungen für 
       die Veranstaltungen „Technische Informatik für EIT/ME“ und 
       „Digitaltechnik für TI“ einsehen. Sie müssen für den Login im Netz
       der Hochschule oder über VPN mit dem Hochschulnetz verbunden sein.
    </p>

    <form action="index.php" method="post">
        <label for="username">Username: </label>
        <input type="text" name="username"><br>
        <label for="password">Password: </label>
        <input type="password" name="password"><br>
        <input type="submit" name="login" value="login">
    </form>
<?php
    if ($login === "nodb") {
        echo "<p>Login hat funktioniert. Leider habe ich sie nicht in der
            Datenbank gefunden.</p>";
    } elseif ($login === "failed") {
        echo "<p>Login failed </p>";
    }
    echo "</body>";
    echo "</html>";
}
?>