-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·78 lines (76 loc) · 2.84 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/*
WebNoter 1.0
(C)2024 Bartłomiej "Magnetic-Fox" Węgrzyn!
*/
session_start();
require_once("apic.php");
require_once("helpers.php");
include_once("stringtable.php");
?>
<!DOCTYPE html>
<html lang="<?php echo ST_HTMLLANG; ?>">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo ST_WEBNOTER; ?></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/bootstrap.bundle.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a href="index.php" class="navbar-brand"><?php echo ST_WEBNOTER; ?></a>
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarCollapse">
<div class="navbar-nav">
<a href="index.php" class="nav-item nav-link active"><?php echo ST_MAINPAGE; ?></a>
<a href="notes.php" class="nav-item nav-link"><?php echo ST_NOTES; ?></a>
<a href="user.php" class="nav-item nav-link"><?php echo ST_USER; ?></a>
<a href="server.php" class="nav-item nav-link"><?php echo ST_SERVER; ?></a>
</div>
<div class="navbar-nav ms-auto">
<?php echo isLoggedIn() ? '' : '<a href="register.php" class="nav-item nav-link">'.ST_REGISTER.'</a>' ?>
<a href="<?php echo isLoggedIn() ? 'logout.php' : 'login.php' ?>" class="nav-item nav-link"><?php echo isLoggedIn() ? ST_LOGOUT : ST_LOGIN ?></a>
</div>
</div>
</div>
</nav>
<div class="container">
<div class="p-2 my-4 bg-light rounded-3">
<?php
if(isLoggedIn()) {
try {
$currentUser=getCurrentUserInfo($_SESSION["credentials"]);
$username=htmlspecialchars($currentUser["username"]);
echo "<h4>".ST_WELCOME.", ".$username."!</h4>";
echo "<p class=\"lead\">".ST_NOW_YOU_CAN_USE_NOTER."</p>";
echo "<p><a href=\"notes.php\" class=\"btn btn-outline-primary\">".ST_GO_TO_NOTES."</a>";
echo "<br><a href=\"user.php\" class=\"btn btn-outline-primary\">".ST_GO_TO_PROFILE."</a>";
echo "<br><a href=\"server.php\" class=\"btn btn-outline-primary\">".ST_GO_TO_SERVER_INFO."</a>";
echo "<br><a href=\"logout.php\" class=\"btn btn-outline-primary\">".ST_LOGOUT."</a></p>";
}
catch(Exception $e) {
echo '<div class="alert alert-danger">' . json_decode($e->getMessage(), true)["error"] . '</div>';
}
}
else {
echo "<h4>".ST_WELCOME_TO_WEBNOTER."</h4>";
echo "<p class=\"lead\">".ST_WHAT_IS_NOTER."</p>";
echo "<p><a href=\"login.php\" class=\"btn btn-outline-primary\">".ST_LOGIN_2."</a></p>";
}
?>
</div>
<hr>
<footer>
<div class="row">
<div class="col-md-6">
<p><?php echo ST_COPYRIGHT; ?></p>
</div>
</div>
</footer>
</div>
</body>
</html>