| 1 | #!/usr/bin/php |
|---|
| 2 | <? |
|---|
| 3 | include ('../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 | $db =& DB::connect($dsn); |
|---|
| 14 | if (DB::isError($db)) |
|---|
| 15 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$db->getMessage()); |
|---|
| 16 | |
|---|
| 17 | $sonet =& DB::connect($dsn_sonet); |
|---|
| 18 | if (DB::isError($sonet)) |
|---|
| 19 | error_log($_SERVER['HTTP_HOST'].' | '.__FILE__.' | Connexion SQL impossible : '.$sonet->getMessage()); |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | $db->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 23 | $sonet->setFetchMode(DB_FETCHMODE_ASSOC); |
|---|
| 24 | |
|---|
| 25 | $user_sonet_r = $sonet->query('SELECT * FROM users WHERE etat=?', 'ok'); |
|---|
| 26 | while($user_sonet = $user_sonet_r->fetchRow()) |
|---|
| 27 | { |
|---|
| 28 | $user_values = array( |
|---|
| 29 | $user_sonet['md5'], |
|---|
| 30 | $user_sonet['fname'], |
|---|
| 31 | $user_sonet['lname'], |
|---|
| 32 | $user_sonet['id_parent_mp5'], |
|---|
| 33 | $user_sonet['login'], |
|---|
| 34 | $user_sonet['passwd'], |
|---|
| 35 | $user_sonet['date'], |
|---|
| 36 | $user_sonet['date'], |
|---|
| 37 | time(), |
|---|
| 38 | 'ok'); |
|---|
| 39 | $db->query('INSERT INTO user SET id=?, fname=?, lname=?, id_parent=?, login=?, passwd=?, join_date=?, invite_date=?, last_visite=?, status=?', $user_values); |
|---|
| 40 | $db->query('INSERT INTO relation SET id=?, id_friend=?', array($user_sonet['md5'], $user_sonet['id_parent_mp5'])); |
|---|
| 41 | $db->query('INSERT INTO relation SET id_friend=?, id=?', array($user_sonet['md5'], $user_sonet['id_parent_mp5'])); |
|---|
| 42 | $db->query('INSERT INTO user_contact SET id=?, email=?, city=?, zip=?', array($user_sonet['md5'], $user_sonet['email'], $user_sonet['ville'], $user_sonet['cp'])); |
|---|
| 43 | $db->query('INSERT INTO user_professional SET id=?, occupation=?', array($user_sonet['md5'], $user_sonet['profession'])); |
|---|
| 44 | $db->query('INSERT INTO user_personal SET id=?, headline=?', array($user_sonet['md5'], $user_sonet['comment'])); |
|---|
| 45 | $db->query('INSERT INTO user_interests SET id=?' , array($user_sonet['md5'])); |
|---|
| 46 | $db->query('INSERT INTO settings SET id=?' , array($user_sonet['md5'])); |
|---|
| 47 | $db->query('INSERT INTO user_general SET id=?' , array($user_sonet['md5'])); |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | $sonet->disconnect(); |
|---|
| 52 | $db->disconnect(); |
|---|
| 53 | |
|---|
| 54 | ?> |
|---|