Jeste jednou trasovani
[mirrors/Kyberia-bloodline.git] / scripts / journauxaccess.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_old=new CLASS_DATABASE("kyberia","kyberia","cyb3ry","127.0.0.1");
11
12$q="select * from nodes where node_type='7'";
13$userset=$db->query($q);
14while ($userset->next()) {
15 $users[$userset->getString('old_id')]=$userset->getString('node_id');
16}
17
18print_r($users);
19
20$q="select * from node_access where node_type='journaux'";
21$set=$db_old->query($q);
22$db->query("set autocommit=0");
23
24while ($set->next()) {
25 echo "OLDUSERID::".$set->getString('user_id');
26
27 $user_id=$users[$set->getString('user_id')];
28 echo "<br>NEWUSERID".$user_id;
29
30 $q="select node_id from nodes where node_type='6' and old_id='".$set->getString('node_id')."'";
31 echo $q;
32 $set2=$db->query($q);
33 $set2->next();
34 $node_id=$set2->getString('node_id');
35
36 $q="insert into node_access set node_id='$node_id',user_id='$user_id',node_bookmark='no',node_permission='".$set->getString('access_type')."'";
37 echo $q."<br>";
38// if ($node_id>0 AND $user_id>0) $db->query($q);
39
40}
41
42
43$db->query("commit");
44
45?>
This page took 0.625767 seconds and 4 git commands to generate.