Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
44 lines (43 loc) · 1.56 KB
/
Copy pathindex.php
File metadata and controls
44 lines (43 loc) · 1.56 KB
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
<?php
session_start();
require_once 'config.php';
function getUserData($id) {
$user = array();
$user["id"] = $id;
$user["email"] = "test@sidet.eu";
$user["name"] = "testuser";
$user["avatar"] = "https://avatar.com/".$id."/avatar.png";
return $user;
}
if (isset($_SESSION["user_id"]) && $_SESSION["user_id"] != "") {
$user = getUserData($_SESSION["user_id"]);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<title>Train View | sidet.eu</title>
</head>
<body onload="updateTrainTable()">
<?php if (isset($_SESSION['user_id'])): $user = getUserData($_SESSION["user_id"]);?>
<button class="sso-login" onclick="logout()">Logout</button>
<p id="name"><?php echo htmlspecialchars($user["name"]); ?></p>
<img id="avatar" src="<?php echo htmlspecialchars($user["avatar"]); ?>" alt=""><br>
<?php else: ?>
<button class="sso-login" onclick="login()">Login</button><br>
<?php endif; ?>
<div class="search-bar">
<input type="text" name="search" id="search" placeholder="Search...">
</div>
<br>
<div id="trains" class="main">
<!-- every row will be it's own div -->
</div>
</body>
<script src="script.js"></script>
</html>