Commit | Line | Data |
---|---|---|
b42b2bf9 H |
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 | ?> |