small events cleanup
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / vote.inc
index 31571d7ac3ad1e9deba188b981207e1dcfdb93fc..77d484769304ebf2441d320b44417a8783a856ca 100644 (file)
@@ -1,37 +1,38 @@
 <?php
 // pokus urobit neco z anketami:-))nerehocte sa moc hlasno:-))
 
-        function vote() {
-                global $node,$db,$error,$referer_id;
-                if (!$referer_id) $referer_id=1;
+function vote() {
+       global $node,$db,$error,$referer_id;
+       if (!$referer_id) $referer_id=1;
 
-                $node_id=$node['node_id'];
-                $user_id=$_SESSION['user_id'];
+       $node_id=$node['node_id'];
+       $user_id=$_SESSION['user_id'];
 
-        $set=$db->query("select * from node_access where node_id='$node_id' and user_id='$user_id' and node_permission='ban'");
-               if($set->getNumRows()>0) {
-                global $error;
-                $error="F ankete si uz hlasoval. nene..uz sa to neda viackrat...dufam:-)";
-               return false;        }
+       $set=$db->query("select * from node_access where node_id='$node_id' 
+               and user_id='$user_id' and node_permission='ban'");
+       if($set->getNumRows()>0) {
+               global $error;
+               $error="One vote is enough for everyone";
+               return false;
+       }
 
 
-$option=$_POST['poll_option'];
+       $option=$_POST['poll_option'];
+       $option--;
 
-$option--;
+       if (!is_numeric($option)) {
+               $error="incorrect poll_option. fck";
+       }
 
-if (!is_numeric($option)) {
-                        $error="incorrect poll_option. fck";
-                }
+       $poll=unserialize($node['node_content']);
+       ++$poll[$option]['number'];
+       $node_content=serialize($poll);
+       $db->query("update nodes set node_content='$node_content'
+               where node_id='$node_id'");
 
-                $poll=unserialize($node['node_content']);
-                ++$poll[$option]['number'];
-                $node_content=serialize($poll);
-                $db->query("update nodes set node_content='$node_content'
-where node_id='$node_id'");
+       $db->query("update node_access set node_permission='ban' where
+       node_id='$node_id' and user_id='$user_id'");
+       Header("Location: /id/".$node['node_parent']."/");
+}
 
-$db->query("update node_access set node_permission='ban' where
-node_id='$node_id' and user_id='$user_id'");
-              Header("Location: /id/".$node['node_parent']."/");
-
-        }
-?>
\ No newline at end of file
+?>
This page took 0.152777 seconds and 4 git commands to generate.