Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | <?php |
2 | //requiring main config file with path/database etc. constants | |
3 | require('../config/config.inc'); | |
4 | ||
5 | //connecting to database and creating universal $db object | |
6 | require(SYSTEM_ROOT.'/inc/log.inc'); | |
7 | require(SYSTEM_ROOT.'/inc/database.inc'); | |
8 | require(SYSTEM_ROOT.'/inc/nodes.inc'); | |
9 | $db=new CLASS_DATABASE(); | |
10 | $db->query("set autocommit=0"); | |
11 | ||
12 | $db_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1"); | |
13 | ||
14 | $q="select * from nodes where node_type='7'"; | |
15 | $userset=$db->query($q); | |
16 | while ($userset->next()) { | |
17 | $users[$userset->getString('old_id')]=$userset->getString('node_id'); | |
18 | } | |
19 | ||
20 | $friendset=$db_old->query("select * from friends"); | |
21 | while ($friendset->next()) { | |
22 | $q="insert into nodes set node_type='8',node_name='friend::".$users[$friendset->getString('friend_id')]."::".$users[$friendset->getString('user_id')]."::".rand(1,23000)."',node_parent='".$users[$friendset->getString('friend_id')]."',node_creator='".$users[$friendset->getString('user_id')]."'"; | |
23 | $db->query($q); | |
24 | echo $q; | |
25 | $q="insert into node_content set node_id=LAST_INSERT_ID(),node_content='".$friendset->getString('friend_text')."'"; | |
26 | echo $q; | |
27 | $db->query($q); | |
28 | $db->query("commit"); | |
29 | ||
30 | } |