forked from soixantecircuits/Pocket-monster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.php
83 lines (82 loc) · 2.81 KB
/
game.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
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
<?php
require_once 'config/config.inc.php';
if(!defined('HOST') && !defined('USER') && !defined('PSW') && !defined('DB')) header('Location: index.php');
require_once 'class/game.class.php';
$Game = new game();
?>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Jouer - Pocket Monster</title>
</head>
<body>
<?php if ($Game->checkWorld()) {?>
<section id="monde">
<h3>Afficher un monde</h3>
<form action="game.php" method="post">
<select name="id_world" id="listWorld">
<?php $_world=$Game->getWorld();
$_wLength = count($_world);
for ($i=0; $i < $_wLength; $i++) {
if ($_world[$i]['id_world']==$_POST['id_world']) {
echo "<option value='{$_world[$i]['id_world']}' selected>{$_world[$i]['name']}</option>";
} else {
echo "<option value='{$_world[$i]['id_world']}'>{$_world[$i]['name']}</option>";
}
}
?>
</select>
<input type="submit" id="afficher" name="afficher" value="Afficher"/>
</form>
</section>
<?php } else { ?>
<p>Il n'y à pas de monde créée.</p>
<?php } ?> <!-- fin checkWorld -->
<?php if($_POST['id_world'] || $_POST['id_family']) {
if ($Game->checkFamily($_POST['id_world'])) {?>
<section id="famille">
<form action="game.php" method="post">
<h3>Afficher une famille</h3>
<select name="id_family" id="listFamily">
<?php $_family=$Game->getFamily($_POST['id_world']);
$_fLength = count($_family);
for ($i=0; $i < $_fLength; $i++) {
if ($_family[$i]['id_family']==$_POST['id_family']) {
echo "<option value='{$_family[$i]['id_family']}' selected>{$_family[$i]['name']}</option>";
} else {
echo "<option value='{$_family[$i]['id_family']}'>{$_family[$i]['name']}</option>";
}
}
?>
</select>
<input type="submit" id="afficher" name="afficher" value="Afficher"/>
</form>
</section>
<?php } else { ?>
<p>Il n'y à pas de famille dans ce monde.</p>
<?php }} ?> <!-- fin checkFamily -->
<?php if($_POST['id_family']) {
if ($Game->checkMonster($_POST['id_family'])) {?>
<section id="monstre">
<form action="game.php" method="post">
<h3>Afficher un monstre</h3>
<select name="id_monster" id="listMonster">
<?php $_monster=$Game->getMonster($_POST['id_family']);
$_mLength = count($_monster);
for ($i=0; $i < $_mLength; $i++) {
if ($_monster[$i]['_monster']==$_POST['_monster']) {
echo "<option value='{$_monster[$i]['_monster']}' selected>{$_monster[$i]['name']}</option>";
} else {
echo "<option value='{$_monster[$i]['_monster']}'>{$_monster[$i]['name']}</option>";
}
}
?>
</select>
<input type="submit" id="afficher" name="afficher" value="Afficher"/>
</form>
</section>
<?php } else { ?>
<p>Il n'y à pas de monstre dans cette famille.</p>
<?php }} ?> <!-- fin checkMonster -->
</body>
</html>