-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkonto.php
More file actions
99 lines (85 loc) · 4.74 KB
/
Copy pathkonto.php
File metadata and controls
99 lines (85 loc) · 4.74 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
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
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<link rel="stylesheet" type="text/css" href="style.css">
<title>Colorcap</title>
</head>
<body>
<header class="header">
<h1 class="logo"><a href="#"><i>Constantia<span class="logo2">Colorcap</span></i></a></h1>
<nav class="main-nav">
<a href="index.php">Home</a>
<a href="leaderboard.php">Leaderboard</a>
<a href="tabela.php">Tabela</a>
<a href="obstaw.php">Obstaw</a>
<div class="konto">
<a class="konto2" tabindex="0"
href="konto.php?user_id=<?php include 'session.php'; include 'data.php'; echo $user_id; ?>">Konto<span id="user-icon"
class="material-symbols-outlined">account_circle</span></a>
<div class="user-info">
<?php
// Połączenie z bazą danych (załóżmy, że używamy MySQL)
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "projekt";
// Tworzenie połączenia
$conn = new mysqli($servername, $username, $password, $dbname);
// Sprawdzenie połączenia
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Pobranie ID użytkownika z sesji lub innego źródła
// Załóżmy, że ID użytkownika przechowywane jest w sesji
include 'data.php';
include 'database_data.php';
echo "<span class='user-name'>".$username."</span><br><hr style='width: 110%; position: relative; left: -10px; top: -4px;'><br>";
echo "<span style='position: relative; top: -20px;'>".$imie." ".$nazwisko."</span>";
// Wyświetl inne dane użytkownika
// Pobierz identyfikator użytkownika z sesji
// Sprawdź, czy parametr user_id został przekazany w adresie URL
if (isset($_GET['user_id'])) {
// Jeśli parametr user_id został przekazany, sprawdź, czy jest to identyfikator bieżącego użytkownika
if ($_GET['user_id'] != $user_id) {
// Jeśli parametr user_id nie zgadza się z identyfikatorem bieżącego użytkownika, przekieruj użytkownika na stronę błędu lub inny adres URL
header("Location: konto.php?user_id=$user_id");
exit();
}
}
$conn->close()
?>
<span class="logout" onclick="logout()">Wyloguj</span>
</div>
</div>
</nav>
</header>
<article>
<div class="container">
<h1>Account Details</h1>
<hr style="top: 10px;">
<img src="user.jpg" style="position: relative; left: 59%;" alt="user" width="175px" height="200px" class="user-img">
<span class="nick"><?php include 'database_data.php'; include 'dane_mistrzostwa.php'; echo $username; ?></span>
<span class="user-rank"><?php if($username!==$admin){echo 'User';}else{echo '<span style="color: red; font-weight:bold; letter-spacing: 1px; margin-left: -5px;">Admin</span>';}?></span>
<div class="tekst">
<?php
include 'data.php';
include 'database_data.php';
echo "<span style='font-weight: bold; color: orange; margin-right: 15px;'>Imie:</span> $imie<br>";
echo "<span style='font-weight: bold; color: orange; margin-right: 15px;'>Nazwisko:</span> $nazwisko<br>";
echo "<span style='font-weight: bold; color: orange; margin-right: 15px;'>E-mail:</span> $email<br><br>";
echo "<i style='font-size: 16px; '>UWAGA! W przypadku potrzeby zmiany hasła lub maila <br>należy kontaktować się bezpośrednio z administratorem!</i>";
?>
</div>
</div>
</article>
<script>
function logout() {
window.location.href = "logout.php";
}
</script>
</body>
</html>