Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / eventz / vote.inc
1 <?php
2 // pokus urobit neco z anketami:-))nerehocte sa moc hlasno:-))
3
4 function vote() {
5 global $node,$db,$error,$referer_id;
6 if (!$referer_id) $referer_id=1;
7
8 $node_id=$node['node_id'];
9 $user_id=$_SESSION['user_id'];
10
11 $set=$db->query("select * from node_access where node_id='$node_id' and user_id='$user_id' and node_permission='ban'");
12 if($set->getNumRows()>0) {
13 global $error;
14 $error="F ankete si uz hlasoval. nene..uz sa to neda viackrat...dufam:-)";
15 return false; }
16
17
18 $option=$_POST['poll_option'];
19
20 $option--;
21
22 if (!is_numeric($option)) {
23 $error="incorrect poll_option. fck";
24 }
25
26 $poll=unserialize($node['node_content']);
27 ++$poll[$option]['number'];
28 $node_content=serialize($poll);
29 $db->query("update nodes set node_content='$node_content'
30 where node_id='$node_id'");
31
32 $db->query("update node_access set node_permission='ban' where
33 node_id='$node_id' and user_id='$user_id'");
34 Header("Location: /id/".$node['node_parent']."/");
35
36 }
37 ?>
This page took 0.288227 seconds and 4 git commands to generate.