Repository navigation
Expand file tree
/
Copy pathsettings.php
More file actions
77 lines (70 loc) · 2.63 KB
/
Copy pathsettings.php
File metadata and controls
77 lines (70 loc) · 2.63 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
<?php
include 'session.php';
include 'connect.php';
?>
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>ReSoC - Paramètres</title>
<meta name="author" content="Julien Falconnet">
<link rel="stylesheet" href="style.css" />
</head>
<body>
<section class="top-bar">
<div class="window-controls">
<button class="close-btn"></button>
<button class="minimize-btn"></button>
<button class="maximize-btn"></button>
</div>
</section>
<?php include 'header.php'; ?>
<div id="wrapper" class='profile'>
<aside>
<img src="user.jpg" alt="Portrait de l'utilisatrice" />
<section>
<h3>Présentation</h3>
<p>Sur cette page vous trouverez les informations de l'utilisatrice
n° <?php echo $userId ?></p>
</section>
</aside>
<main>
<?php
$laQuestionEnSql = "
SELECT users.*,
count(DISTINCT posts.id) as totalpost,
count(DISTINCT given.post_id) as totalgiven,
count(DISTINCT recieved.user_id) as totalrecieved
FROM users
LEFT JOIN posts ON posts.user_id=users.id
LEFT JOIN likes as given ON given.user_id=users.id
LEFT JOIN likes as recieved ON recieved.post_id=posts.id
WHERE users.id = '$userId'
GROUP BY users.id
";
$lesInformations = $mysqli->query($laQuestionEnSql);
if (!$lesInformations) {
echo ("Échec de la requete : " . $mysqli->error);
}
$user = $lesInformations->fetch_assoc();
//echo "<pre>" . print_r($user, 1) . "</pre>";
?>
<article class='parameters'>
<h3>Mes paramètres</h3>
<dl>
<dt>Pseudo</dt>
<dd><?php echo $user['alias'] ?></dd>
<dt>Email</dt>
<dd><?php echo $user['email'] ?></dd>
<dt>Nombre de message</dt>
<dd><?php echo $user['totalpost'] ?></dd>
<dt>Nombre de "J'aime" donnés </dt>
<dd><?php echo $user['totalgiven'] ?></dd>
<dt>Nombre de "J'aime" reçus</dt>
<dd><?php echo $user['totalrecieved'] ?></dd>
</dl>
</article>
</main>
</div>
</body>
</html>