-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
58 lines (44 loc) · 1.15 KB
/
index.php
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
<?php
require __DIR__ . '/vendor/autoload.php';
// Functie: programma login OOP
// Auteur: Younes
// Initialisatie
use Controllers\User;
// require_once 'db/Database.php';
// require_once 'Controllers/User.php';
?>
<!DOCTYPE html>
<html lang="en">
<body>
<h3>PDO Login and Registration</h3>
<hr/>
<h3>Welcome op de HOME-pagina!</h3>
<br />
<?php
// Activeer de session
$user = new User();
session_start();
// Indien Logout geklikt
if (isset($_GET['logout']) && $_GET['logout'] == 'true') {
$user->Logout();
}
// Check login session: staat de user in de session?
// var_dump($_SESSION, "<br>");
if(!$user->IsLoggedin()){
// Alert not login
echo "U bent niet ingelogd. Login in om verder te gaan.<br><br>";
// Toon login button
echo '<a href = "login_form.php">Login</a>';
} else {
// select userdata from database
// $user->GetUser($user->username);
// Print userdata
echo "<h2>Het spel kan beginnen</h2>";
echo "Je bent ingelogd met:<br/>";
$user->ShowUser();
echo "<br><br>";
echo '<a href = "?logout=true">Logout</a>';
}
?>
</body>
</html>