Jeste jednou trasovani
[mirrors/Kyberia-bloodline.git] / scripts / friends2node.php
CommitLineData
b42b2bf9
H
1<?php
2//requiring main config file with path/database etc. constants
3require('../config/config.inc');
4
5//connecting to database and creating universal $db object
6require(SYSTEM_ROOT.'/inc/log.inc');
7require(SYSTEM_ROOT.'/inc/database.inc');
8require(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);
16while ($userset->next()) {
17 $users[$userset->getString('old_id')]=$userset->getString('node_id');
18}
19
20$friendset=$db_old->query("select * from friends");
21while ($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}
This page took 0.287407 seconds and 4 git commands to generate.