Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | <?php |
2 | require('../config/config.inc'); | |
3 | ||
4 | //connecting to database and creating universal $db object | |
5 | require(SYSTEM_ROOT.'/inc/log.inc'); | |
6 | require(SYSTEM_ROOT.'/inc/database.inc'); | |
7 | require(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); | |
13 | while ($pollset->next()) { | |
14 | $polls[$pollset->getString('old_id')]=$pollset->getString('node_id'); | |
15 | } | |
16 | print_r($polls); | |
17 | $q="select * from nodes where node_type='7'"; | |
18 | $userset=$db->query($q); | |
19 | while ($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 | ||
26 | while ($set->next()) { | |
27 | print_r($set->getRecord()); | |
28 | echo "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'"); | |
32 | if ($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 | } |