0) {
$uids=array($_GET['uid']);
} elseif ($uids_first && $uids_last) {
$uids=array();
for ($i=$uids_first;$i<=$uids_last;$i++) $uids[]=$i;
} else exit;
foreach ($uids as $uid) {
$sql='SELECT * FROM '.$forum_table.' WHERE user_id='.$uid.' LIMIT 1';
$result=db_query($sql);
$users_data=db_fetch_object($result);
//var_dump($users_data);
/*
$sql="UPDATE `".$drupal_table."` SET
`name` = '".$users_data->username."',
`pass` = '".$users_data->user_password."',
`mail` = '".$users_data->user_email."',
`created` = '".$users_data->user_regdate."',
`access` = '".$users_data->user_lastvisit."',
`login` = '".$users_data->user_lastvisit."',
`status` = '1',
`timezone` = NULL ,
`signature` = '".$users_data->user_sig."',
`language` = '".$users_data->user_lang."',
`picture` = '".$users_data->user_avatar."',
`init` = '".$users_data->user_email."'
WHERE `uid` =".$users_data->user_id." LIMIT 1";
*/
$sql="REPLACE INTO `users` (
`uid` ,
`name` ,
`pass` ,
`mail` ,
`mode` ,
`sort` ,
`threshold` ,
`theme` ,
`signature` ,
`created` ,
`access` ,
`login` ,
`status` ,
`timezone` ,
`language` ,
`picture` ,
`init` ,
`data`
) VALUES (
'".$users_data->user_id."',
'".$users_data->username."',
'".$users_data->user_password."',
'".$users_data->user_email."',
'0', '0', '0',
'',
'".$users_data->user_sig."',
'".$users_data->user_regdate."',
'".$users_data->user_lastvisit."',
'".$users_data->user_lastvisit."',
'1',
NULL ,
'".$users_data->user_lang."',
'".$users_data->user_avatar."',
'".$users_data->user_email."',
'b:0;'
)";
$result=db_query($sql);
echo 'Скопировали пользователя: '.$uid.'
'.$sql.'
';
}
/*
Если пользователя нет - нужно вставить полные данные. Вот образец:
REPLACE [LOW_PRIORITY | DELAYED]
[INTO] tbl_name [(col_name,...)]
VALUES ({expr | DEFAULT},...),(...),...
INSERT INTO `users` ( `uid` , `name` , `pass` , `mail` , `mode` , `sort` , `threshold` , `theme` , `signature` , `created` , `access` , `login` , `status` , `timezone` , `language` , `picture` , `init` , `data` )
VALUES (
'24', 'hosl24', '9607dcd62d798d25e05b6deee8e6071b', 'hosl@localhost', '0', '0', '0', '', '', '1198024272', '1198024272', '0', '0', NULL , '', '', '', 'b:0;'
);
Дамп полей таблицы users из форума:
object(stdClass)#3 (73) {
["user_id"]=>
string(1) "4"
["user_type"]=>
string(1) "0"
["group_id"]=>
string(1) "2"
["user_permissions"]=>
string(400) "00000000006xv1ssxs
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
qlctzq000000
mh4ikg000000
qlctzq000000
qlctzq000000
qlctzq000000
mh4ikg000000
qlctzq000000
hrctmo000000
hrctmo000000
hrctmo000000
hrctmo000000
hrctmo000000"
["user_perm_from"]=>
string(1) "0"
["user_ip"]=>
string(0) ""
["user_regdate"]=>
string(10) "1193681811"
["username"]=>
string(6) "ed.....r"
["username_clean"]=>
string(6) "editor"
["user_password"]=>
string(32) "ab4ef7c8a4.........e41a31"
["user_passchg"]=>
string(1) "0"
["user_pass_convert"]=>
string(1) "0"
["user_email"]=>
string(17) "not@ru"
["user_email_hash"]=>
string(13) "-115551198921"
["user_birthday"]=>
string(10) " 0- 0- 0"
["user_lastvisit"]=>
string(10) "1202416139"
["user_lastmark"]=>
string(10) "1200500502"
["user_lastpost_time"]=>
string(1) "0"
["user_lastpage"]=>
string(9) "index.php"
["user_last_confirm_key"]=>
string(0) ""
["user_last_search"]=>
string(10) "1201550262"
["user_warnings"]=>
string(1) "0"
["user_last_warning"]=>
string(1) "0"
["user_login_attempts"]=>
string(1) "0"
["user_inactive_reason"]=>
string(1) "0"
["user_inactive_time"]=>
string(1) "0"
["user_posts"]=>
string(3) "140"
["user_lang"]=>
string(2) "ru"
["user_timezone"]=>
string(4) "3.00"
["user_dst"]=>
string(1) "0"
["user_dateformat"]=>
string(14) "D M d, Y g:i a"
["user_style"]=>
string(1) "2"
["user_rank"]=>
string(1) "0"
["user_colour"]=>
string(0) ""
["user_new_privmsg"]=>
string(1) "0"
["user_unread_privmsg"]=>
string(1) "0"
["user_last_privmsg"]=>
string(10) "1195209119"
["user_message_rules"]=>
string(1) "0"
["user_full_folder"]=>
string(2) "-3"
["user_emailtime"]=>
string(1) "0"
["user_topic_show_days"]=>
string(1) "0"
["user_topic_sortby_type"]=>
string(1) "t"
["user_topic_sortby_dir"]=>
string(1) "d"
["user_post_show_days"]=>
string(1) "0"
["user_post_sortby_type"]=>
string(1) "t"
["user_post_sortby_dir"]=>
string(1) "a"
["user_notify"]=>
string(1) "0"
["user_notify_pm"]=>
string(1) "1"
["user_notify_type"]=>
string(1) "0"
["user_allow_pm"]=>
string(1) "1"
["user_allow_viewonline"]=>
string(1) "1"
["user_allow_viewemail"]=>
string(1) "0"
["user_allow_massemail"]=>
string(1) "1"
["user_options"]=>
string(4) "1919"
["user_avatar"]=>
string(5) "4.jpg"
["user_avatar_type"]=>
string(1) "1"
["user_avatar_width"]=>
string(3) "100"
["user_avatar_height"]=>
string(2) "95"
["user_sig"]=>
string(111) "Тебя посодют, а ты не воруй! (с) х/ф "Берегись автомобиля!""
["user_sig_bbcode_uid"]=>
string(8) "3vfb6qsd"
["user_sig_bbcode_bitfield"]=>
string(4) "gA=="
["user_from"]=>
string(0) ""
["user_icq"]=>
string(9) "451046490"
["user_aim"]=>
string(0) ""
["user_yim"]=>
string(0) ""
["user_msnm"]=>
string(0) ""
["user_jabber"]=>
string(0) ""
["user_website"]=>
string(0) ""
["user_occ"]=>
string(2) "PR"
["user_interests"]=>
string(0) ""
["user_actkey"]=>
string(0) ""
["user_newpasswd"]=>
string(0) ""
["user_form_salt"]=>
string(16) "aece07a828d7e160"
}
*/
?>