Minor display cleanup
[mirrors/Kyberia-bloodline.git] / scripts / poll_access.php
CommitLineData
b42b2bf9
H
1<?php
2require('../config/config.inc');
3
4//connecting to database and creating universal $db object
5require(SYSTEM_ROOT.'/inc/log.inc');
6require(SYSTEM_ROOT.'/inc/database.inc');
7require(SYSTEM_ROOT.'/inc/nodes.inc');
8$db=new CLASS_DATABASE();
9$db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1");
10
11$q="select * from nodes where node_type='11'";
12$pollset=$db->query($q);
13while ($pollset->next()) {
14 $polls[$pollset->getString('old_id')]=$pollset->getString('node_id');
15}
16print_r($polls);
17$q="select * from nodes where node_type='7'";
18$userset=$db->query($q);
19while ($userset->next()) {
20 $users[$userset->getString('old_id')]=$userset->getString('node_id');
21}
22
23$q="select * from user_poll";
24$set=$db_old->query($q);
25
26while ($set->next()) {
27print_r($set->getRecord());
28echo "LLALALALA".$set->getString('poll_id');
29$poll_id=$polls[$set->getString('poll_id')];
30$user_id=$users[$set->getString('user_id')];
31$cset=$db->query("select * from node_access where node_id='$poll_id' and user_id='$user_id'");
32if ($user_id AND $poll_id) {
33 $result=$cset->getNumRows();
34 if (!$result) $db->query("insert into node_access set node_id=$poll_id ,user_id=$user_id ,node_permission='ban'");
35 else $db->query("update node_access set node_permission='ban' where node_id='$poll_id' and user_id='$user_id'");
36 unset($result);
37}
38
39}
This page took 0.298177 seconds and 4 git commands to generate.