-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.php
executable file
·120 lines (104 loc) · 3.59 KB
/
user.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?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");
if(!isLoggedIn()) {
header("location: login.php");
exit;
}
?>
<!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"><?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 active"><?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
try {
$currentUser=getCurrentUserInfo($_SESSION["credentials"]);
echo "<h4>".ST_USER_INFORMATION."</h4>";
echo "<div class=\"table-responsive\">";
echo "<table class=\"table table-sm table-hover\">";
echo "<thead class=\"table-dark\">";
echo "<tr>";
echo "<th>".ST_KEY."</th>";
echo "<th>".ST_VALUE."</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
echo "<tr>";
echo "<td>".ST_USER_ID."</td>";
echo "<td>".htmlspecialchars($currentUser["id"])."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".ST_USERNAME."</td>";
echo "<td>".htmlspecialchars($currentUser["username"])."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".ST_REGISTRATION_DATE."</td>";
echo "<td>".htmlspecialchars($currentUser["date_registered"])."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".ST_REGISTERED_USING."</td>";
echo "<td>".htmlspecialchars($currentUser["user_agent"])."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".ST_USER_LAST_CHANGED."</td>";
echo "<td>".htmlspecialchars($currentUser["last_changed"])."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".ST_USER_LAST_CHANGED_USING."</td>";
echo "<td>".htmlspecialchars($currentUser["last_user_agent"])."</td>";
echo "</tr>";
echo "</tbody>";
echo "</table>";
echo "</div>";
echo "<p><a href=\"acc_password.php\" class=\"btn btn-outline-primary\">".ST_CHANGE_PASSWORD."</a> <a href=\"acc_delete.php\" class=\"btn btn-outline-danger\">".ST_REMOVE_ACCOUNT."</a></p>";
}
catch(Exception $e) {
echo '<div class="alert alert-danger">' . json_decode($e->getMessage(), true)["error"] . '</div>';
}
?>
</div>
<hr>
<footer>
<div class="row">
<div class="col-md-6">
<p><?php echo ST_COPYRIGHT; ?></p>
</div>
</div>
</footer>
</div>
</body>
</html>