-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmastermind.php
More file actions
141 lines (129 loc) · 4.1 KB
/
mastermind.php
File metadata and controls
141 lines (129 loc) · 4.1 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!--validato-->
<?php
session_start();
include "logic/gameconstmastermind.php";
?>
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/mastermind.css">
<link rel="icon" type="image/x-icon" href="src/icon.ico">
<title>Mistermind</title>
</head>
<body>
<nav>
<a class="linkLogo" href="index.php">
<img class="icon" src="src/game.png" alt="Logo MindWords">
<h2>MindWords</h2>
</a>
<b id="punteggio">Punteggio: 0</b>
</nav>
<?php
if ($_SERVER["REQUEST_METHOD"] != "POST") {
header("Location: index.php");
}
$points = 100;
switch ($_POST["masterTrys"]) {
case 'Facile':
$try = EasyMasterTrys;
$points -= 25;
break;
case 'Difficile':
$try = HardMasterTrys;
$points += 25;
break;
default:
$try = StdMasterTrys;
break;
}
switch ($_POST["masterLen"]) {
case 'Facile':
$len = EasyMasterSeq;
$points -= 25;
break;
case 'Difficile':
$len = HardMasterSeq;
$points += 25;
break;
default:
$len = StdMasterSeq;
break;
}
echo "
<script>
const isLogged = ". (isset($_SESSION["UtenteMindWords"]) ? "true" : "false") . ";
const numberTrys = ".$try.";
const lenSeq = ".$len.";
const maxPoint = ".$points.";
</script>";
if (isset($_SESSION["UtenteMindWords"])) {
include "logic/dbconnection.php";
$mode = "Mastermind";
include "logic/makesession.php";
echo "
<script>
const user = '".$_SESSION["UtenteMindWords"]."';
const startTime = '".$time."';
</script>";
$db_connection->close();
}
?>
<div id="popup" class="sparire">
<div class="blocker"></div>
<div class="box sparire">
<div class="colorPopup stylePopup"></div>
</div>
<div class="box sparire">
<div class="stylePopup errorPopUp">
<h1>Inserisci tutti i colori</h1>
<button id="notFull">Ok, scusa</button>
</div>
</div>
<div class="box sparire">
<div class="stylePopup endGamePopup">
<h1>Testo prova</h1>
<hr>
<h2>Punteggio: </h2>
<div class="try" id="result">
<?php
for ($i=0; $i < $len; $i++) {
echo "<div class='resultColor'></div>";
}
?>
</div>
<a href="index.php">Torna alla home</a>
</div>
</div>
</div>
<div id="section">
<div class="playArea">
<?php
for (; $try > 0; $try--) {
echo "
<div>
<div class='try'>
";
for ($i=0; $i < $len; $i++) {
echo
"<div class='colorResult'>
<div class='color'></div>
</div>";
}
echo "
</div>
<button class='guess'></button>
</div>
";
}
?>
</div>
</div>
<?php
include "view/footer.php"
?>
<script type="module" src="js/mastermind.js"></script>
</body>
</html>