-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjogo.php
More file actions
78 lines (67 loc) · 2.4 KB
/
jogo.php
File metadata and controls
78 lines (67 loc) · 2.4 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
<!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/jogo.css">
<title>Jogo da Memória | Partida</title>
<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
<script src="js/jogo.js"></script>
<script src="js/gameTimer.js"></script>
<?php
include("verificaLogin.php");
if(array_key_exists('result', $_POST))
ins_hist();
function ins_hist(){
include('db_infos.php');
try {
$conn = new PDO("mysql:host=$sname;dbname=jogomemoria", $uname, $pwd);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO partida VALUES (
DEFAULT,
". $_POST['mode'] .",
'". $_POST['boardSize'] ."',
'". $_POST['time'] ."',
". $_POST['result'] .",
DEFAULT,
". $_POST['moves'] .",
'". $_SESSION['user'] ."')";
$conn->exec($sql);
}
catch(PDOException $e){
echo "Connection failed: " . $e->getMessage();
}
}
?>
</head>
<body onload="loadBoard(); getElementsJogo();">
<header>
<a href="index.php" class="goBackButton"><img src="img/close.png" alt=""></a>
</header>
<div>
<div class="menu">
<div>
<img src="img/textoLogo.png" alt="Jogo da memória" id="imgLogo">
</div>
<div class="timer">
<p id="contText">00:00</p>
<p class="itemLabel" id="gameModeLabel">Clássico</p>
</div>
<div class="menuItem">
<p class="itemLabel">Tabuleiro:</p>
<p id="boardSize"></p>
</div>
<div class="menuItem">
<p class="itemLabel">Jogadas:</p>
<p id="movements"></p>
</div>
<div class="divButton">
<button value=0 onclick="toggleVisibility()" id="tButton">Trapaça</button>
</div>
</div>
<div class="board">
</div>
</div>
</body>
</html>