aboutsummaryrefslogtreecommitdiffstats
path: root/inc/perso.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/perso.inc')
-rw-r--r--inc/perso.inc23
1 files changed, 23 insertions, 0 deletions
diff --git a/inc/perso.inc b/inc/perso.inc
new file mode 100644
index 0000000..0362d8c
--- /dev/null
+++ b/inc/perso.inc
@@ -0,0 +1,23 @@
+<?php
+function sendPerso() {
+ if(empty($_SESSION["perso"]))
+ initPerso();
+ return $_SESSION["perso"];
+}
+
+function updatePerso(){
+ $hp = $_POST["hp"];
+ $xp = $_POST["xp"];
+ $lv = $_POST["lv"];
+ $_SESSION["perso"]["hp"] = $hp;
+ $_SESSION["perso"]["xp"] = intval($xp);
+ $_SESSION["perso"]["lv"] = $lv;
+}
+
+function initPerso(){
+ $_SESSION["perso"]["hp"] = 5;
+ $_SESSION["perso"]["xp"] = 0;
+ $_SESSION["perso"]["lv"] = 3;
+}
+
+?>