-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhistorico.php
56 lines (46 loc) · 1.87 KB
/
historico.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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<title> TRABALHO 3 - PHP </title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<header>
<div id="logo">
<img id="tetris-logo" src="img/project-logo.png" alt="logotipo">
</div>
</header>
<section>
<a href="index.php"><button id="button" onclick="historico.php">Voltar ao Jogo</button></a>
<div id="historico">
<div class="title">
<h3>Histórico de Partidas</h3><hr>
<?php
session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] == false){
echo "Please login first to see this page.";
header("Location: login.php");
}
try{
$conn = new PDO("mysql:host=localhost;dbname=bancophp", "root", "");
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM pontuacao WHERE username_dados = '".$_SESSION['username']."'";
$grava = $conn->prepare($sql);
$grava->execute(array());
$i=0;
while($row = $grava->fetch(PDO::FETCH_ASSOC)) {
$i++;
echo '<ul id="dados">';
echo '<li><b>Name:</b>'.$row['username_dados'].'<b> points:</b>'.$row['pontos'].'<b> level:</b>'.$row['level'].'<b> Time:</b>'.$row['tempo'].'</li>';
echo '</ul>';
}
}catch(PDOException $e){
echo "Ocorreu um erro: " . $e->getMessage();
}
?>
</div>
</div>
</section>
</body>
</html>