-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperfil.php
More file actions
95 lines (83 loc) · 3.3 KB
/
perfil.php
File metadata and controls
95 lines (83 loc) · 3.3 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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/padrao.css">
<link rel="stylesheet" href="css/perfil.css">
<title>Perfil</title>
<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
<?php
include("verificaLogin.php");
?>
</head>
<body>
<header class="header">
<a href="index.php" class="goBackButton"><img src="img/back.png" alt=""></a>
</header>
<main>
<?php
include('db_infos.php');
try {
$conn = new PDO("mysql:host=$sname;dbname=jogomemoria", $uname, $pwd);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->query("SELECT * FROM usuario WHERE username ='" . $_SESSION['user'] . "'");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $conn->query("SELECT COUNT(*) qty FROM partida WHERE username ='" . $_SESSION['user'] . "'");
$qty = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $conn->query("SELECT COUNT(*) win FROM partida WHERE username ='" . $_SESSION['user'] . "'
and resultado=1");
$win = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $conn->query("SELECT COUNT(*) defeat FROM partida WHERE username ='" . $_SESSION['user'] . "'
and resultado=0");
$defeat = $stmt->fetch(PDO::FETCH_ASSOC);
echo "<div class='informationBox'>
<div class='userBox'>
<div id='perfilImgDiv'>
<img src='img/perfilImg.png' alt='' id='perfilImg'>
</div>
<h1>". $row['nome'] . "</h1>
<h2>". $row['username'] . "</h2>
</div>
<div class='subInformationalBox'>
<h2 class='title'>Dados cadastrais</h2>
<div class='cadastralInformation'>
<p> Data nascimento: ". $row['dtnasc'] . "</p>
<p> E-mail: ". $row['email'] . "</p>
</div>
<div class='cadastralInformation'>
<p> CPF: ". $row['cpf'] . "</p>
<p> Telefone: ". $row['telefone'] . "</p>
</div>
</div>
</div>
<div class='numberBox'>
<div class='numberInformation'>
<p class='number'></p>
<p class='information'></p>
</div>
<div class='numberInformation'>
<p class='number'>". $qty['qty'] . "</p>
<p class='information'>Partidas jogadas</p>
</div>
<div class='numberInformation'>
<p class='numberWin'> ". $win['win'] ."</p>
<p class='informationWin'>Vitórias</p>
</div>
<div class='numberInformation'>
<p class='numberDefeat'>". $defeat['defeat'] ."</p>
<p class='informationDefeat'>Derrotas</p>
</div>
</div>";
}
catch(PDOException $e){
echo "Connection failed: " . $e->getMessage();
}
?>
</main>
<footer>
<a href="alterarDados.php" class="editarButton">Editar</a>
</footer>
</body>
</html>