blob: 43fdc66700c9a4eb9927702fb0ef63d3b913dc99 (
plain)
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
|
<?php
require_once("inc/mine.inc");
require_once("inc/guild.inc");
require_once("inc/shop.inc");
require_once("inc/craftmine.inc");
require_once("inc/dungeon.inc");
require_once("inc/savegame.inc");
session_start(); // Must be placed *BEFORE* $_SESSION is actually used and *AFTER* all classes are imported
$op = "";
/**
* Indique au client une message requete.
*/
function reportBadRequest() {
header("HTTP/1.1 400 Bad Request");
echo "Format de la requete incorrect.";
echo "Il est attendu une requete de type POST avec 2 parametres:";
echo "<ul>";
echo "<li><b>op</b>: l'operation a executer ('inc', 'dec')</li>";
echo "<li><b>pos</b>: la position du hero dans la liste</li>";
echo "</ul>";
echo "<br/>";
echo "La requete aura ete executee avec succes lorsque la page retournera un code 200";
echo "<br/>Parametres POST recu: ";
var_dump($_POST);
echo "<br/>Parametres GET recu: ";
var_dump($_GET);
exit();
}
if (!isset($_POST["op"])) {
if(!isset($_GET["op"]))
reportBadRequest();
else
$op = $_GET["op"];
} else $op = $_POST["op"];
/**
* On récupère l'opération à exécuter et on le fait.
*/
switch($op) {
case "withdrawMine": withdrawMine(); break;
case "createGuild": createGuild(); break;
case "hireMiner": hireMiner(); break;
case "getCraftMine": sendCraftMine(); break;
case "buildShop": buildShop(); break;
case "buyItem": buyItem(); break;
case "buildDungeon" : buildDungeon(); break;
case "launchDungeon" : launchDungeon(); break;
case "exitDungeon" : exitDungeon(); break;
case "sendDungeonProgress" : sendDungeonProgress(); break;
case "saveGame": saveGame(); break;
case "downSave": downSave(); break;
case "listSaves": listSaves(); break;
case "loadSave": loadSave(); break;
case "deleteSave": deleteSave(); break;
default: reportBadRequest();
}
?>
|