-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
54 lines (53 loc) · 1.72 KB
/
profile.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
<?php
include('includes/config.php');
include('includes/header.php');
?>
session_start();
<div class="content">
<?php
$db = connect();
$query = $db->prepare("SELECT * FROM users WHERE id = :id");
$query->execute(array(
'id' => $_GET['id']
));
$data = $query->fetch();
if ($data) {
if (!isset($data['img'])) {
echo "<img class='profile' src='http://www.webdesignerforum.co.uk/uploads/profile/photo-1407.jpg?_r=1396701824'>";
} else {
echo "<img class='profile' src='".$data['img']."'>";
}
echo "<h1>".$data['login']."</h1>";
if ($data['online'])
echo "<h3 style='color: green;'>Online</h3>";
else
echo "<h3 style='color: red'>Offline</h3>";
echo "<h4>Ratio de victoire: </h4>";
if ($data['pwon'] + $data['ploose'])
$ratio = intval(($data['pwon'] / ($data['pwon'] + $data['ploose']) * 100), 100);
else
$ratio = 0;
echo $ratio."% ";
if ($ratio < 10) {
echo "<i class='icon-neutral'></i>";
} else if ($ratio < 50) {
echo "<i class='icon-smiley'></i>";
} else if ($ratio < 70) {
echo "<i class='icon-cool2'></i>";
} else if ($ratio < 90) {
echo "<i class='icon-shocked2'></i>";
} else {
echo "<i class='icon-evil'></i>";
}
echo "<br /><br />Nombre de partie jouees: ".($data['pwon'] + $data['ploose'])."<br />";
echo "Nombre de partie gagnees: <span style='color: green'>".$data['pwon']."</span><br />";
echo "Nombre de partie perdues: <span style='color: red'>".$data['ploose']."</span><br />";
if ($_SESSION['id'] == $_GET['id']) {
echo "<br /><a href='modif_profil.php'><button style='height: 80px; width: 250px; font-size: 20px;'>Modifier mon profil</button></a>";
}
} else {
echo "<h1>Profile not found :(</h1>";
}
?>
</div>
<?php include('includes/footer.php'); ?>