-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexplore.php
74 lines (69 loc) · 2.45 KB
/
explore.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
<?php
session_start();
$pagename = "Explore for Mozos";
include_once("includes/check-new-mozos.php");
include_once("includes/check-user.php");
include_once("includes/header.php");
require_once("includes/functions.php");
require_once("includes/open_db.php");
if (isset($_POST['new-mozos'])) {
switch ($_POST['new-mozos']) {
case 'common':
$_SESSION['new-mozos'] = array();
$_SESSION['new-mozos'][] = get_random_mozo($db, 1)['mozoSpecies'];
header('Location: new-mozos.php');
break;
case 'random':
$_SESSION['new-mozos'] = array();
$_SESSION['new-mozos'][] = get_random_mozo($db, random_rarity())['mozoSpecies'];
header('Location: new-mozos.php');
break;
case 'scarce':
$_SESSION['new-mozos'] = array();
$_SESSION['new-mozos'][] = get_random_mozo($db, 3)['mozoSpecies'];
header('Location: new-mozos.php');
break;
case 'illusive':
$_SESSION['new-mozos'] = array();
$_SESSION['new-mozos'][] = get_random_mozo($db, 5)['mozoSpecies'];
header('Location: new-mozos.php');
break;
}
print_r($_SESSION['new-mozos']);
}
if (isset($_POST['explore'])) {
$event = random_event();
} else {
$event = [
"message" => "Your exploration starts here!",
"id" => 0,
];
}
?>
<main class='thick-border flex-centered-column'>
<figure>
<?php
echo "
<img src='imgs/explore/{$event['id']}.png' alt='{$event['message']}'>
<figcaption>
<p>{$event['message']}</p>
</figcaption>
";
?>
</figure>
<?php if (isset($event['rarity'])) { ?>
<div>
<form method='post'>
<button type='submit' value='<?php echo $event['rarity'] ?>' name='new-mozos' formaction='#'>Collect Mozo!</button>
</form>
</div>
<?php } else { ?>
<form method='post'>
<button type='submit' value='explore' name='explore' formaction='#'>Explore</button>
</form>
<nav class='flex-row-just-center'><a href='index.php'>Return to Den</a></nav>
<?php } ?>
</main>
<?php include_once("includes/footer.php"); ?>
</body>
</html>