Hierarchy fixup
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / set_mood.inc
diff --git a/wwwroot/inc/eventz/set_mood.inc b/wwwroot/inc/eventz/set_mood.inc
new file mode 100644 (file)
index 0000000..cf7f107
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+function set_mood() {
+       global $db,$error;
+
+       $set = $db->query(sprintf('select moods from users where user_id = %d', $_SESSION['user_id']));
+       $set->next();
+       $moods_expl = explode(";",$set->getString('moods'));
+       $moods_expl[count($moods_expl)-1] = $_POST['mood'];
+
+       if (is_numeric($_POST['mood'])) {
+               $_SESSION['mood_id'] = $_POST['mood'];
+               $set = $db->query(sprintf('select node_name, node_content from nodes where node_id = %d', $_POST['mood']));
+               $set->next();
+               $_SESSION['mood_name'] = strip_tags($set->getString('node_name'));
+               $_SESSION['mood_content'] = addslashes(substr(strip_tags($set->getString('node_content')),0,223));
+       }
+       else {
+           $_SESSION['mood_id'] = '';
+           $_SESSION['mood_name'] = '';
+           $_SESSION['mood_content'] = '';
+       }
+       $moods = implode(";",$moods_expl);
+       $db->query(sprintf('update users set moods="%s" where user_id=%d', $moods, $_SESSION['user_id']));
+}
+?>
This page took 0.092843 seconds and 4 git commands to generate.