root/trunk/robots/create_sonet_id_parent_md5.bot.php

Revision 1, 0.9 KB (checked in by anonymous, 7 years ago)

initial import

Line 
1#!/usr/bin/php
2<?
3include ('../includes/includes.inc.php');
4
5$dsn_sonet = array(
6    'phptype'  => 'mysql',
7    'username' => 'sonet',
8    'password' => 's0n3t!p4ss',
9    'hostspec' => 'localhost',
10    'database' => 'sonet',
11);
12
13$sonet =& DB::connect($dsn_sonet);
14if (DB::isError($sonet))
15                error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$sonet->getMessage());
16
17
18$sonet->setFetchMode(DB_FETCHMODE_ASSOC);
19
20$user_sonet_r = $sonet->query('SELECT * FROM users WHERE etat=?', 'ok');
21while($user_sonet = $user_sonet_r->fetchRow())
22{
23    print $user_sonet['id'] .' '.$user_sonet['md5'] .' '.$user_sonet['id_parent'] ."\n";
24    $id_parent = $sonet->getOne('SELECT md5 FROM users WHERE id=?', array($user_sonet['id_parent']));
25    print $id_parent."\n--\n";
26    $sonet->query('UPDATE users SET id_parent_mp5=? WHERE id=?', array($id_parent, $user_sonet['id']));
27}
28
29$sonet->disconnect();
30
31?>
Note: See TracBrowser for help on using the browser.